2013-12-21 53 views
0

我將引擎掛載到應用程序,並且我想在整個父應用程序中使用其中一個引擎的幫助程序。在父Rails應用程序中使用掛載引擎中的幫助程序

在我的虛擬應用程序,我把這個虛擬的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 

它是確定的。

但是,當我把它安裝到真正的應用程序,從引擎幫手不工作。

如何加載它,所以它可以做的東西遍佈父應用程序?

回答

0

明白了。

我試過set_sourcebuster_data裏面名字空間引擎(http://lvh.me:3000/sourcebuster)。

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

將它添加到發動機的application_controller.rb,現在它做的東西都在應用程序)

相關問題