Hi, I have an authentification application with methods such as "logged_in?" in controllers/application.rb. But when I moved the application.rb from a real app to an engine, these methods are not known anymore. I call the method from a controller within the engine. Did I miss anything? Side note: the login_controller in the engine is called, so the engine is active in a way. Patrick
on 2007-06-22 20:30
on 2007-06-24 12:28
Repost, because I wasn't subscribed to the mailing list: > I have an authentification application with methods such as "logged_in?" > in controllers/application.rb. But when I moved the application.rb from > a real app to an engine, these methods are not known anymore. I call the > method from a controller within the engine. Did I miss anything? > > Side note: the login_controller in the engine is called, so the engine > is active in a way. > > Patrick
on 2007-06-24 16:36
IIRC, engines cause rails to scan plugin/app/controller/**/*_controller.rb. If you are overriding ApplicationController in the plugin, you might need to go to plugin/lib or somewhere else guaranteed to load. Just a Guess, Marc
on 2007-06-24 18:43
Hi Marc, > IIRC, engines cause rails to scan > plugin/app/controller/**/*_controller.rb. Most likely, yes. > If you are overriding ApplicationController in the plugin, you might > need to go to plugin/lib or somewhere else guaranteed to load. What I do now is copy the code to myplugin.rb and require it from init.rb. This works fine, although it doesn't feel 'right'. But what counts is that it works as intended so thanks for the hint! Patrick
on 2007-06-26 18:01
It seems wrong to me that you'd even want a file called "application.rb" in a plugin. If you want methods to be available to all controllers, you can achieve this by adding the methods to ActionController::Base via module inclusion. Having routable controllers in plugins doesn't mean that *everything* under your_plugin/app should get mixed - code mixing is the special case, and shouldn't be relied upon too much.
on 2007-06-26 19:09
The approach I've used was to name a library after your engine (e.g. module FooEngine in foo_engine.rb in the plugin's lib directory) then include it into your application.rb -- Tony Arcieri ClickCaster, Inc.
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.