Administrator Kiranatama Staff
Knowledge


This is useful if you want to have a hash that contains values of your 'development' or 'production' configuration. If it is after the Rails app started, we can just do: config = Rails::Configuration.new database = config.database_configuration["production"] (Now you have access to database[:password], etc) Without Rails, we can do file_handle = YAML.load(File.new("path/to/database.yml") hashes = file_handle.each {|value| value.inspect} (Now you have access to hashes["production"])