Skip to content

Instantly share code, notes, and snippets.

@sue445
Created March 6, 2015 08:52
Show Gist options
  • Save sue445/4ca20eadc49e1af93adf to your computer and use it in GitHub Desktop.
Save sue445/4ca20eadc49e1af93adf to your computer and use it in GitHub Desktop.
Rails 4.2のconfig_forで遊んでみた
# 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
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
@sue445
Copy link
Author

sue445 commented Mar 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment