Hi all !

I am extracting chunks of code into engines from an existing app.  One
model I'm extracting is Recipient.

I followed the LoginEngine convention:

app/models/recipient.rb:
class Recipient < AR::Base
  include XlPop::Recipient
end

lib/xl_pop/recipient.rb
module XlPop
  module Recipient
    def self.included(base)
      base.send :include, XlPop::Recipient::InstanceMethods
      base.send :extend, XlPop::Recipient::ClassMethods
      base.validates_presence_of ...
    end

    module ClassMethods
      ...
    end

    module InstanceMethods
      ...
    end
  end
end

The other models I extracted worked correctly, but loading Recipient complains:

$ ruby script\console
Loading development environment.
./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:123:in
`const_missing':NameError: uninitialized constant Recipient
>>

I added some code to
vendor/rails/activesupport/lib/active_support/dependencies.rb to show
me what files were loaded and the load path at that time.  I noticed
that vendor/plugins/xl_pop/app/models is NOT in the load path.  Is
that to be expected ?

I did try creating my model in app/models, and it works.  So, I am
inclined to think the missing models directory in the load path is the
problem.

Thanks all !
-- 
François Beausoleil
http://blog.teksol.info/
_______________________________________________
engine-users mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org

Reply via email to