我有一个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
那么,好像帮助者通常不是在控制器中使用!