How do I access a Rails configuration value during runtime?

前端 未结 2 1216
情书的邮戳
情书的邮戳 2021-02-02 05:39

I\'m using Rails 2.3.x. I would like a small section of code to run if and only if the config.cache_classes is true. By default, that\'s true for production and f

2条回答
  •  臣服心动
    2021-02-02 06:01

    Depending on where you are in a module, you may need to access the root namespace. This should provide access from anywhere in a universal way for rails 3+:

    ::Rails.application.config

提交回复
热议问题