1

单击昨天使用的用户配置文件链接edit_user_registration_path( ) 时。http://localhost:3000/users/edit今天出现一个 404 错误,看起来像这样。

    Routing Error

    No route matches {:controller=>"devise/ideas"}
    Try running rake routes for more information on available routes.

我检查了rake routes,我得到了

           like_idea GET    /ideas/:id/like(.:format)      ideas#like
        comment_idea POST   /ideas/:id/comment(.:format)   ideas#comment
               ideas GET    /ideas(.:format)               ideas#index
                     POST   /ideas(.:format)               ideas#create
            new_idea GET    /ideas/new(.:format)           ideas#new
           edit_idea GET    /ideas/:id/edit(.:format)      ideas#edit
                idea GET    /ideas/:id(.:format)           ideas#show
                     PUT    /ideas/:id(.:format)           ideas#update
                     DELETE /ideas/:id(.:format)           ideas#destroy
    new_user_session GET    /users/sign_in(.:format)       devise/sessions#new
        user_session POST   /users/sign_in(.:format)       devise/sessions#create
destroy_user_session GET    /users/sign_out(.:format)      devise/sessions#destroy
       user_password POST   /users/password(.:format)      devise/passwords#create
   new_user_password GET    /users/password/new(.:format)  devise/passwords#new
  edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit
                     PUT    /users/password(.:format)      devise/passwords#update
cancel_user_registration GET    /users/cancel(.:format)        devise/registrations#cancel
   user_registration POST   /users(.:format)               devise/registrations#create
new_user_registration GET    /users/sign_up(.:format)       devise/registrations#new
edit_user_registration GET    /users/edit(.:format)          devise/registrations#edit
                     PUT    /users(.:format)               devise/registrations#update
                     DELETE /users(.:format)               devise/registrations#destroy
                root        /                              home#index

看起来正确的人可以看到正确的路线,因为edit_user_registration_path 我是 Ruby 新手,所以任何帮助都将不胜感激。

4

2 回答 2

2

问题不是您的 edit_user_registration_path 。

如果您查看错误消息,Rails 正在设计文件夹(即“devise/ideas”)中寻找一个想法控制器。如果您在那里没有控制器,则意味着您在某处调用了不正确的路径。

于 2013-04-20T19:18:44.607 回答
-1

edit_user_registration_path需要用户 ID。

所以你需要类似的东西edit_user_registration_path(@user)

于 2013-04-20T06:20:23.477 回答