Last Updated: February 25, 2016
·
1.184K
· shadabahmed

Bundler Require

If you want your ruby project to auto-require gems specified in a group in Gemfile then :

require 'bundler/setup'
Bundler.require(:group)

You won't need to write require for gems then, except for gems like ActiveRecord which are part of larger gems like rails. This is very handy in spec_helper where I just need to say Bundler.require(:default, :test)

If a gem is not found it will ask user to do a bundle install instead of throwing an error on require