Search code examples
ruby-on-railsruby-on-rails-4rails-engines

Use before_filter define in main_app inside engine


I have a before filter that I currently use inside my main_app call "action" and I normally call it by saying

before_filter :action

Right now I have an engine that I need to use that same filter, but if I use that exact method I get the following error:

undefined method `action' (for Engine bla bla..) 

For other cases I just added main_app upfront and that solved the issue. Not the case. Any help?

UPDATE Right now i have this:

module MyEngine
  class MyEngineController < ApplicationController

    before_filter :main_app do
      :action
    end

Solution

  • can you do something like

    class MyController < EngineController
        skip_before_filter :authorize, :only => [:setup]
    
        def setup
            super
        end
    end