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
?
You can use the --without flag to exclude environments
$ bundle install --without development test
http://gembundler.com/groups.html
What version of bundler are you using? recent ones should not install in vendor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With