我试图理解为什么我的类方法未被识别。下面是我的代码:
wiki_patch.rb
require_dependency 'wiki_content'
module WikiRecipientPatch
def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
alias_method_chain :recipients, :send_wiki_mail
end
end
end
module InstanceMethods
def self.set_mail_checker(mail)
@mail_checker = mail
end
end
Rails.configuration.to_prepare do
WikiContent.send(:include, WikiRecipientPatch)
end
控制器.rb
WikiContent.set_mail_checker(params[:mail_checker_wiki])
我收到此错误:
NoMethodError (undefined method `set_mail_checker' for #<Class:0x4876560>):
知道为什么会发生这种情况以及解决方案是什么吗?