我正在使用这个第 3 方控制器:
class LibController
def update
# 29 lines of code
respond_with resource
end
end
我想做一些除了respond_with
结尾之外的事情。但我不想只是将所有 29 行复制/粘贴到MyController.update
. 不幸的是,我想不出一种在其他任何地方渲染或重定向的方法:
class MyController < LibController
def update
super
redirect_to somewhere_else
end
end
我得到一个DoubleRenderError: Render and/or redirect were called multiple times in this action
. 我认为这是因为立即respond_with
致电render
。有没有办法阻止/防止这种情况?
谢谢!