Last active
June 8, 2016 02:15
-
-
Save ilake/fc68aee49aec15a4e2865a635863bb26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Rails.application.config_for(:database) | |
=> {"adapter"=>"mysql2", "encoding"=>"utf8", "reconnect"=>false, "database"=>"listia_development", "pool"=>5, "username"=>"listia", "socket"=>"/tmp/mysql.sock"} | |
> h = Hashie::Mash.new(Rails.application.config_for(:database)) | |
=> #<Hashie::Mash adapter="mysql2" database="listia_development" encoding="utf8" pool=5 reconnect=false socket="/tmp/mysql.sock" username="listia"> | |
> h.adapter | |
=> "mysql2" | |
> h.database | |
=> "listia_development" | |
class Application < Rails::Application | |
config.x.foo = Hashie::Mash.new(Rails.application.config_for(:bar)) | |
... | |
# Then you could use Rails.configuration.x.foo.yyy to access the config value of current environment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment