A way to add before_filter from engine to application

前端 未结 1 1852
一生所求
一生所求 2020-12-10 08:12

Without a lot of specific code, this is just vague, but I\'ll provide what I can.

Given a rails engine, a basic engine and not a mountable engine in its own space, h

相关标签:
1条回答
  • 2020-12-10 08:31

    If I understood you correctly you can use initializer, for example:

    module MyEngine
        class Engine < Rails::Engine
            initializer  "myengine.load_helpers" do
                ActiveSupport.on_load(:action_controller) do
                    include MyEngine::Helpers
                end
            end
        end
    end
    
    0 讨论(0)
提交回复
热议问题