【发布时间】:2011-04-21 11:38:09
【问题描述】:
我正在寻找有关redirect_to 行为的一些说明。
我有这个代码:
if some_condition
redirect_to(path_one)
end
redirect_to(path_two)
如果some_condition == true 我得到这个错误:
在此操作中多次调用渲染和/或重定向。请注意,您只能调用渲染或重定向,并且每个操作最多调用一次。
似乎该方法在redirect_to 调用之后继续执行。我需要这样写代码吗:
if some_condition
redirect_to(path_one)
return
end
redirect_to(path_two)
【问题讨论】:
标签: ruby-on-rails