0

我有点困惑 - 当用户创建成功时。

我可以打电话(工作)

if @wibiya_user.save
 render :edit
end

但是为什么当我写

   if @wibiya_user.save
       format.html { redirect_to edit_wibiya_user_path(@wibiya_user) }
   end

我收到路由错误:

No route matches {:action=>"edit", :controller=>"wibiya_users"}

但是我的路线确实有:

     resources :wibiya_users
 ...
rake routes
  edit_wibiya_user GET    /wibiya_users/:id/edit(.:format) wibiya_users#edit

为什么会这样?

4

1 回答 1

1

将您的用户控制器(文件名、类名、重定向等)更改为 WibiyaUsersController。

说明:文件resources :wilibya_user中的routes.rb设置该资源的各种路由。它假设控制器被调用wibiya_users_controller

于 2012-09-08T13:28:27.073 回答