有人知道我为什么
undefined method `my_method' for #<MyController:0x1043a7410>
当我从ApplicationController子类中调用我的_方法("字符串")时?我的控制器看起来像
class MyController < ApplicationController
def show
@value = my_method(params[:string])
end
end
还有我的助手
module ApplicationHelper
def my_method(string)
return string
end
end
最后是ApplicationController
class ApplicationController < ActionController::Base
after_filter :set_content_type
helper :all
helper_method :current_user_session, :current_user
filter_parameter_logging :password
protect_from_forgery # See ActionController::RequestForgeryProtection for details