Ruby on rails 3 轨道路由问题。将资源从复数改为单数give“;“没有路线匹配”;错误

Ruby on rails 3 轨道路由问题。将资源从复数改为单数give“;“没有路线匹配”;错误,ruby-on-rails-3,rest,routing,routes,Ruby On Rails 3,Rest,Routing,Routes,**更新:这个问题是关于Rails中的一个bug:** **结束更新** 我尝试使用单一资源(如),因为我喜欢这种类型的更好的url /user/new 相比 /users/new 所以在我的路线中,我从 resources :users 到 现在在我看来,命令 form_for(@user) do |f| 给出错误: No route matches {:controller=>"users"} 有线索吗 这是rake路由的输出 user_index GET /user

**更新:这个问题是关于Rails中的一个bug:**

**结束更新**

我尝试使用单一资源(如),因为我喜欢这种类型的更好的url

/user/new
相比

/users/new
所以在我的路线中,我从

resources :users

现在在我看来,命令

form_for(@user) do |f|
给出错误:

No route matches {:controller=>"users"}
有线索吗

这是rake路由的输出

user_index GET    /user(.:format)          {:action=>"index",  :controller=>"users"}
           POST   /user(.:format)          {:action=>"create", :controller=>"users"}
  new_user GET    /user/new(.:format)      {:action=>"new",    :controller=>"users"}
 edit_user GET    /user/:id/edit(.:format) {:action=>"edit",   :controller=>"users"}
      user GET    /user/:id(.:format)      {:action=>"show",   :controller=>"users"}
           PUT    /user/:id(.:format)      {:action=>"update", :controller=>"users"}
           DELETE /user/:id(.:format)      {:action=>"destroy",:controller=>"users"}

尝试
resource:user
而不是
resources:user
,因为这是一条单条路线。
一条单一的资源丰富的路线会生成以下助手:

  • 新建用户路径返回/user/new
  • 编辑用户路径返回/用户/编辑
  • 用户\路径返回/用户

因此,
users\u path
现在将是
user\u path

尝试
resource:user
而不是
resources:user
,因为这是一条单一的路径。
一条单一的资源丰富的路线会生成以下助手:

  • 新建用户路径返回/user/new
  • 编辑用户路径返回/用户/编辑
  • 用户\路径返回/用户

因此,
users\u path
现在应该是
user\u path

这个问题是关于Rails中的一个bug的:


这个问题是关于Rails中的一个bug:


您是否尝试了
resource:user
而不是
resources:user
您是否有
userscoontroller
UserController
?我有userscoontroller,复数形式。一切都是通过“scaffold”生成的。你有没有尝试过
resource:user
而不是
resources:user
你有没有
userscoontroller
UserController
?我有userscoontroller,复数。一切都是通过“scaffold”和“resource:user”生成的。我得到了错误“未定义的方法`users\u path` for#”。错误是通过“form_for(@user)do | f |”命令生成的。Rails是否试图使用“用户路径”而不是“用户路径”来忽略路由配置?我开始想,也许使用复数资源更好……使用“resource:user”我得到了错误“未定义的方法`users\u path` for#”。错误是由“form_for(@user)do | f |命令生成的。Rails是否试图使用“用户路径”而不是“用户路径”来忽略路由配置?我开始想,也许坚持多元资源更好。。。
user_index GET    /user(.:format)          {:action=>"index",  :controller=>"users"}
           POST   /user(.:format)          {:action=>"create", :controller=>"users"}
  new_user GET    /user/new(.:format)      {:action=>"new",    :controller=>"users"}
 edit_user GET    /user/:id/edit(.:format) {:action=>"edit",   :controller=>"users"}
      user GET    /user/:id(.:format)      {:action=>"show",   :controller=>"users"}
           PUT    /user/:id(.:format)      {:action=>"update", :controller=>"users"}
           DELETE /user/:id(.:format)      {:action=>"destroy",:controller=>"users"}