This project is archived and is in readonly mode.
Rails 2.3 RC1 engine problem with load-order when used with restful_authentication and role_requirement
-
Adam McCrea
I just got bit by this as well. In my case I had a controller inside my engine plugin that subclassed ApplicationController (as most controllers do). This forces ApplicationController - and any modules it includes - to be loaded with the plugin on the first request.
The problem comes on the next request when (in development) Rails tries to unload most constants in the application, including ApplicationController and the modules it included (if they were in /lib). Since plugins don't get reloaded between requests, though, my plugin was trying to hold on to these constants, producing the "removed from the module tree but is still active" error message.
I fixed the problem by adding this to the init.rb for my plugin:
ActiveSupport::Dependencies.load_once_paths.delete( File.expand_path(File.dirname(__FILE__))+'/app/controllers')The scenario and how it all works is explained better here.
-
Adam McCrea
I should also add that I'm not sure this is something that needs "fixed" in Rails, but it could certainly use some documentation. I'm not even sure if what I did is a good way to fix the problem, or if I'm trying to do something I shouldn't.
-
James Adam
I can't replicate this using your template. I generate the application, start script/server (in development mode), and then hit
http://localhost:3000/welcomeas many times as I can.Should I try to log in using the restful_auth you've installed?
-
Dan Croak
We get around this problem in Clearance by using the
unloadablemethod: -
Santiago Pastorino
- State changed from new to open
- Tag changed from 2.3-rc1, engines, load-order, restful_authentication, role_requirement to 23-rc1, engines, load-order, restful_authentication, role_requirement
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
