Skip to content

Instantly share code, notes, and snippets.

@awesome
Created August 1, 2017 19:47
Show Gist options
  • Save awesome/b1b4e16cc90b884ad0dd33cf568e0c88 to your computer and use it in GitHub Desktop.
Save awesome/b1b4e16cc90b884ad0dd33cf568e0c88 to your computer and use it in GitHub Desktop.
Easily load config files in Rails 4.2
# "Easily load config files
# OK, I might be biased. But having a built-in way to load config files is going to be awesome.
# config_for, new in Rails 4.2, works exactly like you’d expect:"
# http://www.justinweiss.com/articles/the-lesser-known-features-in-rails-4-dot-2/
Rails.application.config_for(:database)
# => {"adapter"=>"mysql2", "encoding"=>"utf8", "database"=>"development_db", "username"=>"root", "password"=>nil, "host"=>"localhost", "pool"=>5, "socket"=>"/tmp/mysql.sock"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment