LoadError: Expected X to define on gem upgrade

17 views
Skip to first unread message

Anthony

unread,
Mar 7, 2012, 1:13:41 AM3/7/12
to rubyonra...@googlegroups.com
I'm upgrading to the latest version of ActiveAdmin and am running into the following when trying to start the app:

Expected ../app/model/store/base.rb to define Base

base.rb defines base like:

module MyApp
  class Store::Base
  end
end

I've done some digging and found that ActiveAdmin did some refactoring to derive everything from a BaseController. It also depends on another gem (InheritedResources), which does:
        self.resource_class ||= begin
          namespaced_classes = self.name.sub(/Controller/, '').split('::')
          namespaced_class = [namespaced_classes.first, namespaced_classes.last].join('::').singularize
          namespaced_class.constantize
        rescue NameError
          nil
        end

From: https://github.com/josevalim/inherited_resources/blob/master/lib/inherited_resources/class_methods.rb

So I guess Rails is trying to load the model Base and is wrongly deciding that my existing base.rb file should take precedence or something, but since it's not namespaced to just Base it raises this error.

How can I fix this? I've tried loading the ActiveADmin BaseController file in application.rb, defining a pseudo Base class deriving from BaseController, etc., but nothing seems to work.
Reply all
Reply to author
Forward
0 new messages