Reputation: 28463
Can you configure rails to only run an initializer under certain environments? In my case I had to hack paperclip to work with Imagemagick on my dev box, so I have monkeypatched code I want only to apply to the development environ, not the production environment. That monkeypatch is saved as a file in config\initializers.
The guides.rubyonrails.org site does not indicate that one can do this. If I can't I suppose I just won't check this patch into my repo, but that would not be ideal.
Upvotes: 10
Views: 3162
Reputation: 31454
You could put this in an after_initialize
block in config/environments/development.rb
, or just surround it with if Rails.env.development?
in the initializer you already have.
I think either of these would work for you.
Upvotes: 19