Even with bundler your gem order can be significant

Posted . Visible to the public.

Even when you're using bundler, it might be significant in which order your gems are listed in your Gemfile. This can happen when gems are running around calling require or require_dependency on other gems or application classes when loaded (don't do that!).

A known culprit of this is the (otherwise wonderful) resource_controller Show archive.org snapshot gem, which requires ApplicationController when loaded. When your ApplicationController requires later-loaded gems when loaded, Rails will not boot.

Here is an example for an ApplicationController requiring Aegis::Controller from the aegis Show archive.org snapshot gem:

class ApplicationController < ActionController::Base
  include Aegis::Controller
end

In this case aegis must be listed before resource_controller in your Gemfile or Rails will not boot.

Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2010-10-01 11:51)