簡體   English   中英

在父級Rails應用程序中使用已安裝引擎的助手

[英]Using helpers from mounted engine in parent Rails app

我將引擎安裝到該應用程序,並且想在整個父應用程序中使用引擎的幫助程序之一。

在我的Dummy應用程序中,我將其放在Dummy的application_controller.rb

class ApplicationController < ActionController::Base
  include Sourcebuster::CookieSettersHelper
  before_filter :set_sourcebuster_data
  helper_method :extract_sourcebuster_data

  private

    def set_sourcebuster_data
      set_sourcebuster_cookies
    end

end

沒關系。

但是,當我將其安裝到實際應用程序中時,來自引擎的幫助程序就無法正常工作。

如何加載它,以便它可以在整個父應用程序中完成任務?

得到它了。

我試圖在命名空間引擎( http://lvh.me:3000/sourcebuster )中設置set_sourcebuster_data

在這種情況下, 應用程序的 application_controller.rb before_filter不起作用。

將其添加到引擎的 application_controller.rb ,現在它在整個應用程序中進行處理)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM