Rails: Per-environment initializers?

后端 未结 3 550
臣服心动
臣服心动 2020-12-15 03:16

I\'d like the code in one of my initializers (in config/initializers/) to be run only for the :development environment, but not :test

3条回答
  •  爱一瞬间的悲伤
    2020-12-15 03:45

    I'm pretty sure your only two options are putting the configuration code in config/environments/development.rb or wrapping your initializer code with your if block. You can tighten up your second option by doing if Rails.env.development?, though.

提交回复
热议问题