我有一個CopiesHelper
模塊,其方法爲cc
。找不到幫手方法
在我ApplicationController
,我有
helper :all
helper_method :cC#just tried putting this in recently
如果在我的控制器的一個又一個,我嘗試使用cc
方法,我得到
undefined method 'cc' for #<OtherController:0xblublublublub>
我錯過了一步嗎?
我有一個CopiesHelper
模塊,其方法爲cc
。找不到幫手方法
在我ApplicationController
,我有
helper :all
helper_method :cC#just tried putting this in recently
如果在我的控制器的一個又一個,我嘗試使用cc
方法,我得到
undefined method 'cc' for #<OtherController:0xblublublublub>
我錯過了一步嗎?
如果你想用你的CopiesHelper
在你的控制器之一,簡單地做:
在{} APP_DIR /app/controllers/your_controller.rb
class YourController < ApplicationController
include CopiesHelper
如果你想使用您的應用的每個控制器中的CopiesHelper
只需執行以下操作:
in {app_dir} /app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
include CopiesHelper
那麼,好像幫助者通常不是在控制器中使用!