我已经在ApplicationController中定义了方法
class ApplicationController < ActionController::Base helper_method :get_active_gateway def get_active_gateway(cart) cart.account.gateways end end
class Order < ActiveRecord::Base def transfer active= get_active_gateway(self.cart) end end
它抛出错误undefined局部变量get_active_gateway.
所以我写了
class Order < ActiveRecord::Base def transfer active= ApplicationContoller.helpers.get_active_gateway(self.cart) end end
我在Rails 3.2.0中工作.
请给出解决方案.