繁体   English   中英

嵌套模型的react_with呈现错误的URL

[英]respond_with nested models renders wrong url

对于嵌套的资源,以便每个Driver都有多个Bookings

resources :drivers do 
    resources :bookings
end

bookings控制器的“创建”操作中,我有:

respond_with(@booking.driver, @booking)

当我调用create操作时,正确创建预订后,它应该呈现show页面。 它呈现正确的页面,但地址是index的地址:

https://localhost:3000/drivers/30/bookings

代替

https://localhost:3000/drivers/30/bookings/47

这意味着,如果刷新show页面,它将尝试将您带到“索引”页面,而不是“显示”页面

我正在使用Jquery Mobile,它正在更改URL。

解决方案是将data-url =“ <%= request.path%>”添加到要访问的页面的div中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM