开发者

Ruby on Rails 2.3.8: params is undefined in before_filter?

  before_filter :only => :destroy do |controller| 
      controller.is_object_on_same_account_as_current_account开发者_StackOverflow社区_for_id?(controller_name.classify.constantize, params[:id])
  end

generates error:

NameError: undefined local variable or method `params' 
 app/controller/controller:4

I thought params was always available throughout the request process... =\


Try controller.params[:id] since params is defined for the controller.


Try request.params[:id] or controller.request.params[:id]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜