有人知道为什么我会收到以下错误信息吗?
undefined method `my_method' for #<MyController:0x1043a7410>
当我在我的ApplicationController子类内调用my_method("string")时会发生什么?我的控制器看起来是这样的:
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