Hi all, I'm hoping someone here can maybe shed some insight into this
problem I've run into. I'm trying to break several pieces of reusable
application functionality into Rails engines. I have no trouble at all
getting one engine to work, but the app doesn't seem to load data from
subsequent engines. I'm developing multiple engines simultaneously, so
I'm requiring them into my testapp's gemfile with the :path option.
Here's my (simplified) setup (based on my understanding of the bare
minimum to setup an engine with a simple model):
my_engines/engine1/lib/engine1.rb:
module Engine1
require 'engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
end
my_engines/engine1/lib/engine.rb:
require 'engine1'
require 'rails'
module Engine1
class Engine < Rails::Engine
end
end
my_engines/engine1/app/models/engine1/model1.rb:
module Engine1
class Model1
end
end
My second Engine, engine2 is setup identically and in the same parent
directory (just with the name engine2 and the model model2).
I'm using jeweler to package and generate gemspecs for both engines,
and I'm requiring both engines in a test application like so:
my_engines/testapp/Gemfile:
gem 'engine1', :path => '../engine1'
gem 'engine2', :path => '../engine2'
The weird thing is that when I fire up rails console for my testapp,
Engine1::Model1.new works, but Engine1::Model1.new results in
"NameError: uninitialized constant Engine2::Model2". This seems to be
true for all models, routes, controllers, etc. that I include into any
subsequent engines. I've scoured the internet to no avail. Any
thoughts?
--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby