title: Rails 3.1 Engine: How do I get the engine application_controller to talk to the client app's application_controller?
body: <p>I have a new, mountable rails 3.1 engine and I need the client app, that being the rails app that will include this engine, to define a generic permission based method.</p>
  
  <p>So, what I want is in my engine's blog controller to say something like:</p>
  
  <p><code>before_filter :redirect_unless_admin</code></p>
  
  <p>And then I want to leave it to the client app to define who is an admin. However, whenever I try this I get:</p>
  
  <pre><code>NameError in Blog::BlogsController#show
  
  undefined local variable or method `redirect_unless_admin' for #&lt;Blog::BlogsController:0x000001058aa038&gt;
  </code></pre>
  
  <p>My client app controller looks something like this:</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
  
    # Required by blog engine
    def redirect_unless_admin
      if !logged_in?
        set_session_redirect
        redirect_to login_path, :notice =&gt; 'Please log in.'
      elsif !current_user.admin?
        set_session_redirect
        redirect_to root_path, :notice =&gt; 'You do not have permission to view this page.'
      end
    end
  </code></pre>
  
  <p>And in my engine app controller, I have the following:</p>
  
  <pre><code>module Blog
    class ApplicationController &lt; ActionController::Base
    end
   end
  </code></pre>
  
  <p>Can somebody tell me how to set it up so that my engine's blog controller can talk to my client's application_controller? </p>