Render engine within application layout

后端 未结 3 530
清歌不尽
清歌不尽 2021-01-31 16:47

Background

I am creating a application that is made up of a core and several modules. The modules are rails engines, and provide the actual functionality as the core i

3条回答
  •  攒了一身酷
    2021-01-31 17:36

    Use layout 'layouts/application'

    And if you don't want to use main_app.your_path you can also add:

    module YourEngine
      module ApplicationHelper
        def method_missing(method, *args, &block)
          if (method.to_s.end_with?('_path') || method.to_s.end_with?('_url')) && main_app.respond_to?(method)
            main_app.send(method, *args)
          else
            super
          end
        end
      end
    end
    

提交回复
热议问题