2010-06-07 75 views
1

我有一个CopiesHelper模块,其方法为cc找不到帮手方法

在我ApplicationController,我有

helper :all 
helper_method :cC#just tried putting this in recently 

如果在我的控制器的一个又一个,我尝试使用cc方法,我得到

undefined method 'cc' for #<OtherController:0xblublublublub> 

我错过了一步吗?

回答

0

如果你想用你的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 
0

那么,好像帮助者通常不是在控制器中使用!