Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3.0 Engine - Execute code in ActionController
    text
    copied!<p>I am upgrading my Rails plugin to be an engine that works with the latest 3.0RC1 release and I'm having a bit of trouble figuring out the best (and most correct) way to extend <code>ActionController</code>. I've seen <a href="http://weblog.rubyonrails.org/2010/2/9/plugin-authors-toward-a-better-future" rel="nofollow noreferrer">this post</a> by DHH and <a href="https://stackoverflow.com/questions/1387119/how-to-properly-extend-actioncontroller-in-rails-plugin">this question</a> here on SO, but my question is more about how to properly call code within the <code>ActionController</code>.</p> <p>For instance, I need to call the following within my engine's controller:</p> <pre><code>class ApplicationController &lt; ActionController::Base helper :all before_filter :require_one_user after_filter :store_location private def require_one_user # Code goes here end def store_location # Code goes here end end </code></pre> <p>I know how to properly include my two private functions, but I can't find a way to get it to properly call <code>helper</code>, <code>before_filter</code> and <code>after_filter</code>.</p> <p>I would greatly appreciate some links or a way to make this work. I have tried naming my controller something other than <code>ApplicationController</code> and having the real <code>ApplicationController</code> extend it, but that doesn't seem to work either. I'm really up for any solution that makes the life of the engine user as easy as possible. Ideally, they wouldn't have to extend my class, but they'd have all of the functionality built into their own <code>ApplicationController</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload