如何在alias_method_chain中转发块?

时间:2014-06-03 06:39:35

标签: ruby-on-rails ruby

我遇到需要使用alias_method_chain

的情况
 alias_method_chain :allowed_to?, :update

 def allowed_to_with_update?(action, context, options={}, &block)
   if action.eql?(:update)
     false
    else
      allowed_to_without_update?(action, context, options, &block)
    end
 end

显示错误,

stack level too deep

在这一行,

 allowed_to_without_update?(action, context, options, &block)

知道如何转发阻止?

0 个答案:

没有答案