&tag(Rails4/Tips);
*目次 [#c316da6f]
#contents
*関連ページ [#l6627179]
*参考情報 [#r3f03daa]

*設定 [#r4dc9953]
**ちょっとした設定値を保存したい [#wef17e2e]
-development / productionごとに異なる設定値を保存する方法。[[ruby - Where can I store site-wide variables in Rails 4? - Stack Overflow:http://stackoverflow.com/questions/20857886/where-can-i-store-site-wide-variables-in-rails-4]]にあるように、development.rbで以下のように定義し、
 config.my_special_value = 'val'
-次のように参照するのが簡単か。
 Rails.application.config.my_special_value
-method_missingで勝手に値が保存される。


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS