I have a Rails application that uses Bundler for dependency management. I've got the following in my Gemfile
:
# default group:
gem 'json'
group 'development' do
gem 'my_profiler'
end
group 'test' do
gem 'mocha'
end
group 'deployment' do
gem 'foo'
end
I call Bundler.setup(:default, RAILS_ENV.to_sym)
and Bundler.require(:default, RAILS_ENV.to_sym)
in my initializers.
The problem is that since Bundler puts the gems into vendor/bundle/
, Rails initializes all gems that have an init.rb
, not just those for the current environment. How do I prevent Rails from automatically loading Foo's init.rb
?