如果一个项目正在运行Rails 2.2.2,它使用controller.helper
并且helper
未定义,那么它如何解决? (这是针对Facebooker2 gem http://github.com/mmangino/facebooker2)
细节:
错误显示:
=> Rails 2.2.2 application starting on http://0.0.0.0:3000
Exiting
/Library/
Ruby/
Gems/1.8/gems/facebooker2-0.0.5/lib/facebooker2/rails/controller.rb:8:
in `included': undefined method `helper' for Object:Class (NoMethodError)
代码是:错误行是第8行:
controller.helper Facebooker2::Rails::Helpers
在以下代码中:
module Facebooker2
module Rails
module Controller
def self.included(controller)
controller.helper Facebooker2::Rails::Helpers
controller.helper_method :current_facebook_user
controller.helper_method :current_facebook_client
controller.helper_method :facebook_params
end