First, if you are packing a gem, do not useBundler.require . Bundler.requirefor non gem applications.
In .gemspecindicate the dependencies of your deployed gem.
In your Gemfileinclude line gemspecto automatically include the dependencies listed .gemspecin your Gemfile.
You can also create gem groups for dev and test.
There are clearly requireany libraries you need in your code .
Today I lost a couple of hours, so I hope this helps.
(Sources 1 , 2
Secondly, although the ActiveRecord stone is called "activerecord", the lib is called "active_record". This is what you need at Gemfile.
gem 'activerecord', :require => "active_record"
If you have not enabled the option :require, ActiveRecord will not load correctly, and you will not know about it until you try to use it.