Rails 3 - Nested Resources Routing - One to One relationship

我是研究僧i 提交于 2019-12-02 00:26:45

If you look closely at your route, you'll see that it expects both a :user_id and an :id. The latter, in this case, refers to the user profile.

In order to tell Rails that you want that particular profile, you'll have to specify both the user and the profile in your link, like this:

edit_user_profile_path(current_user, @profile)

Now, Rails will use the first argument (current_user) for the :user_id part of the route, and the second argument (@profile) for the :id.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!