I was having a bit of trouble on the latest edge rails with my
controllers
not being loaded, so I made a few changes to engines.rb in the engines
plugin directory. Basically, on the last three references to $LOAD_PATH,
I
added a line afterwards doing exactly the same thing with
Dependencies.load_paths:
# add these LAST on the load path.
load_paths.reverse.each { |dir|
if File.directory?(dir)
Engines.log.debug "adding #{File.expand_path(dir)} to the load
path"
#$LOAD_PATH.push(File.expand_path(dir))
$LOAD_PATH.push dir
Dependencies.load_paths.push dir
end
}
# Add the other engines back onto the bottom of the $LOAD_PATH.
Put
them back on in
# the same order.
$LOAD_PATH.push(*old_plugin_paths)
Dependencies.load_paths.push(*old_plugin_paths)
$LOAD_PATH.uniq!
Dependencies.load_paths.uniq!
I'm sure this is utterly awful code, but it was just a quick fix to get
it
working, since I don't know if the problem was with engines, rails or
me.
I'm not sure whether I was doing something wrong in the first place to
make
it so my controllers could not be found. I do know that the Dependencies
module in active support didn't have the app directory for my engine in
its
load path (the one I found by actually tracing the application's
execution),
but by the same token, it _was_ in the application's load path earlier
in
execution. The really weird things is the libs and models for my engine
_were_ loading fine when the controllers weren't.
Also, I can't tell if it was working previously and changed with an
update
to the latest rails, as I only just added the controllers to my
application.
on 2006-12-15 09:36
on 2006-12-15 10:48
Hi James, Can you check which versions of Rails/Ruby/Engines plugin you're using? If you can also give a listing of your load paths (i.e. the output of "puts $LOAD_PATH", "puts Dependencies.load_paths" and "puts ActionController::Routing.controller_paths"), it would help me track down what the issue might be. - James
on 2006-12-15 15:34
Ruby is 1.8.4 Engines is at revision 489 (its the latest one in svn at the time of writing) Rails is at 5719 (again latest one in svn at time of writing) >> puts $LOAD_PATH ./script/../config/../config/../vendor/rails/actionwebservice/lib/action_web_service/vendor/ ./script/../config/../config/../vendor/rails/actionmailer/lib/action_mailer/vendor/ ./script/../config/../config/../vendor/rails/actionpack/lib/action_view/helpers/../../action_controller/vendor/html-scanner ./script/../config/../config/../vendor/rails/actionpack/lib/action_view/vendor ./script/../config/../config/../vendor/rails/actionpack/lib ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/vendor ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib ./script/../config/../config/../vendor/rails/activerecord/lib script/../config/../config/../test/mocks/development script/../config/../config/../app/controllers/ script/../config/../config/../app script/../config/../config/../app/models script/../config/../config/../app/controllers script/../config/../config/../app/helpers script/../config/../config/../components script/../config/../config/../config script/../config/../config/../lib script/../config/../config/../vendor/plugins/numbat_rbac/lib script/../config/../config/../vendor/plugins/redhillonrails_core/lib script/../config/../config/../vendor/plugins/foreign_key_migrations/lib script/../config/../config/../vendor/plugins/engines/lib script/../config/../config/../vendor script/../config/../config/../vendor/plugins/numbat_rbac/lib/ script/../config/../config/../vendor/plugins/engines/lib/ script/../config/../config/../vendor/plugins/foreign_key_migrations/lib/ script/../config/../config/../vendor/plugins/redhillonrails_core/lib/ /var/www/getadrafter.dyndns.org/trunk/vendor/rails/railties/builtin/rails_info/ script/../config/../config/../vendor/rails/railties script/../config/../config/../vendor/rails/railties/lib script/../config/../config/../vendor/rails/actionpack/lib script/../config/../config/../vendor/rails/activesupport/lib script/../config/../config/../vendor/rails/activerecord/lib script/../config/../config/../vendor/rails/actionmailer/lib script/../config/../config/../vendor/rails/actionwebservice/lib /usr/local/lib/site_ruby/1.8 /usr/local/lib/site_ruby/1.8/x86_64-linux /usr/local/lib/site_ruby /usr/lib/ruby/1.8 /usr/lib/ruby/1.8/x86_64-linux . script/../config/../config/../vendor/plugins/numbat_rbac/app/models script/../config/../config/../vendor/plugins/numbat_rbac/app/helpers script/../config/../config/../vendor/plugins/numbat_rbac/app/controllers => nil >> puts Dependencies.load_paths script/../config/../config/../test/mocks/development script/../config/../config/../app/controllers/ script/../config/../config/../app script/../config/../config/../app/models script/../config/../config/../app/controllers script/../config/../config/../app/helpers script/../config/../config/../components script/../config/../config/../config script/../config/../config/../lib script/../config/../config/../vendor script/../config/../config/../vendor/plugins/numbat_rbac/lib/ script/../config/../config/../vendor/plugins/engines/lib/ script/../config/../config/../vendor/plugins/foreign_key_migrations/lib/ script/../config/../config/../vendor/plugins/redhillonrails_core/lib/ /var/www/getadrafter.dyndns.org/trunk/vendor/rails/railties/builtin/rails_info/ script/../config/../config/../vendor/plugins/numbat_rbac/lib script/../config/../config/../vendor/plugins/numbat_rbac/app/models script/../config/../config/../vendor/plugins/numbat_rbac/app/helpers script/../config/../config/../vendor/plugins/numbat_rbac/app/controllers => nil >> puts ActionController::Routing.controller_paths script/../config/../config/../app/controllers script/../config/../config/../components /var/www/getadrafter.dyndns.org/trunk/vendor/rails/railties/builtin/rails_info/ script/../config/../config/../vendor/plugins/numbat_rbac/app/controllers script/../config/../config/../vendor/plugins/numbat_rbac/components => nil Bear in mind, thats all after the modifications I made. With the changes commented out, Dependencies.load_paths looks like this: >> puts Dependencies.load_paths script/../config/../config/../test/mocks/development script/../config/../config/../app/controllers/ script/../config/../config/../app script/../config/../config/../app/models script/../config/../config/../app/controllers script/../config/../config/../app/helpers script/../config/../config/../components script/../config/../config/../config script/../config/../config/../lib script/../config/../config/../vendor script/../config/../config/../vendor/plugins/numbat_rbac/lib/ script/../config/../config/../vendor/plugins/engines/lib/ script/../config/../config/../vendor/plugins/foreign_key_migrations/lib/ script/../config/../config/../vendor/plugins/redhillonrails_core/lib/ /var/www/getadrafter.dyndns.org/trunk/vendor/rails/railties/builtin/rails_info/ => nil
on 2006-12-15 15:38
Hi again James, With the SVN revisions, you also need to give the path (i.e. is it trunk or a branch or tag...); also, could you send all the load paths *without* your change. You may also wish to enable the engines logger (see the README, section "Engines.log"). That'll help us track down what the problem is. - James
on 2006-12-15 15:46
The bottom set of load paths is for Dependencies.load_paths without the change. For ActionController::Routing.controller_paths and $LOAD_PATH, they are identical with and without the changes I made. Engines svn is http://svn.rails-engines.org/plugins/engines, Rails svn is http://dev.rubyonrails.org/svn/rails/trunk
on 2006-12-15 15:53
I can tell you immediately that you will have problems using the current *public* release of the engines plugin with the *trunk* version of Rails; they're not compatible, as was discussed earlier on this list. Instead, please use the 1.2 release branch of the engines plugin, and pay special attention to documentation regarding edge rails: http://svn.rails-engines.org/engines/branches/rb_1.2 HTH, James
on 2006-12-16 01:54
Oh, sorry about that, I only signed up for this list a day or two ago so I probably didn't see it. Thanks for the help, and it all works now :-)
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.