This is done through bundler/setup : http://bundler.io/v1.3/bundler_setup.html . It is required inside your config/boot.rb . In short, it first sets an environment variable pointing to your Gemfile:
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
Then it adds paths for all your gems to LOAD_PATH, requiring bundler/setup :
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
Then this requires all the necessary stones (config / application.rb):
Bundler.require(*Rails.groups)
source share