【发布时间】:2013-01-06 04:48:27
【问题描述】:
我在嵌套模型表单中同时创建位置和用户。我希望用户被带到刚刚创建的位置 ID 的位置显示页面。我该怎么做?
我知道我可以通过将其放入应用程序控制器来获取位置索引
def after_sign_in_path_for(resource)
locations_path # <- Path you want to redirect the user to.
end
我试过了
def after_sign_in_path_for(resource)
location_path(@location) # <- Path you want to redirect the user to.
end
但它为 id 提供了 nil 值。有什么想法吗?
【问题讨论】:
标签: ruby-on-rails devise routes nested-forms