Rails: Per-environment initializers?

后端 未结 3 576
臣服心动
臣服心动 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:53

    I don't know if this is a good idea, but it's a different idea.

    You could create a config/initializers/development directory (or config/environments/development/initializers), put your barista_config.rb in that directory, and then include anything in that directory from config/environments/development.rb.

    I don't know if that's a good idea or not but it's at least a third option...just in case you're still thinking about this problem three and a half years after asking the question.

提交回复
热议问题