gpt4 book ai didi

ruby-on-rails - 关于同一个 Controller 中的 redirect_to 的快速 Ruby on Rails 问题

转载 作者:行者123 更新时间:2023-12-03 16:10:36 26 4
gpt4 key购买 nike

在给定的 Controller “BobsController”中,redirect_to 方法中的 Controller 参数是可选的,因此:

redirect_to(:controller => 'bobs', :action => 'index')

是相同的:
redirect_to :action => 'index'

在 BobsController 类中使用时?我假设是因为 Controller 是从当前 Controller 派生的?

最佳答案

是的,你是对的。如果 :controller 未提供,则它假定当前 Controller 。

关于ruby-on-rails - 关于同一个 Controller 中的 redirect_to 的快速 Ruby on Rails 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1739903/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com