In my config/database.yml
file i need to retrieve the current file path. I've tried this :
<%
logger = Logger.new(STDOUT)
logger.debug __FILE__
%>
That outputs (erb)
instead of ./config/database.yml
I know i can get the file path using
Rails.root.join('config', 'database.yml')
But that's just not satisfying as it's not dynamic.
The goal here is to get the unix name of the file owner in order to use it as a prefix to the database name so more than one developer can work with different database without the risk of committing unwanted changes :
development:
database: <%= Etc.getpwuid(File.stat(__FILE__).uid).name %>_project_db