Created
March 6, 2015 08:52
-
-
Save sue445/4ca20eadc49e1af93adf to your computer and use it in GitHub Desktop.
Rails 4.2のconfig_forで遊んでみた
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
# config/precure.yml | |
common: &common | |
smile_precure: | |
cure_happy: 星空みゆき | |
cure_sunny: 日野あかね | |
cure_peace: 黄瀬やよい | |
cure_march: 緑川なお | |
cure_beauty: 青木れいか | |
development: | |
<<: *common | |
smile_precure: | |
cure_echo: 坂上あゆみ | |
test: | |
<<: *common | |
staging: | |
<<: *common | |
production: | |
<<: *common |
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
Loading development environment (Rails 4.2.0) | |
# deep mergeは対応していない模様 | |
irb(main):002:0> Rails.application.configure { config_for(:precure) } | |
=> {"smile_precure"=>{"cure_echo"=>"坂上あゆみ"}} | |
# 中身はただのHash | |
irb(main):003:0> Rails.application.configure { config_for(:precure).class } | |
=> Hash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ソースコード
https://github.com/rails/rails/blob/v4.2.0/railties/lib/rails/application.rb#L210-L240