Rails: Per-environment initializers?

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.


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.


Barista has a config setting for this:

Barista.configure do |c|
  c.env = :development
end

This will only recompile coffescript into js in dev mode and should speed up your tests.

Make sure you run:

rake barista:brew

before checking your code in.

https://github.com/Sutto/barista