我想在around_action
中包装我的动作:
around_action { do_stuff("foo") }
我的around_action
如下:
def do_stuff(arg)
some_block do
Rails.logger.error "arg: #{arg}"
yield
end
end
但这会引发LocalJumpError no block given (yield)
。我在做什么错了?
答案 0 :(得分:0)
我最终用以下方法解决了它:
around_action -> (controller, block) { do_stuff("foo", block) }
def do_stuff(arg, block)
some_block do
Rails.logger.error "arg: #{arg}"
block.call
end
end