Rails 这两种中断 redirect_to 的方式有区别吗

zouyu · 2018年05月11日 · 最后由 msg7086 回复于 2018年05月15日 · 1508 次阅读

redirect_to root_url and return 

return redirect_to root_url

redirect_to root_url
return

和上面两种也是等价的

木有区别(其实我回复是为了加深印象)

一般是为了省函数,再加上英语读起来比较顺口。

if whatever?
  redirect_to root_url
  return
end

vs

redirect_to root_url and return if whatever?
需要 登录 后方可回复, 如果你还没有账号请 注册新账号