我从Rails 3.2升级到4.2.6,并且由于某种原因,一个模型突然发现它的rails生成的资源路径名都错了。所有其他模型的资源都运行良好。
routes.rb(注释掉隔离故障模型的所有其他路由)
Rails.application.routes.draw do
resources :signups
end
rails 3.2 rake routes输出(它看起来应该是什么样的)
signups GET /signups(.:format) signups#index
POST /signups(.:format) signups#create
new_signup GET /signups/new(.:format) signups#new
edit_signup GET /signups/:id/edit(.:format) signups#edit
signup GET /signups/:id(.:format) signups#show
PUT /signups/:id(.:format) signups#update
DELETE /signups/:id(.:format) signups#destroy
rails 4.2.6 rake routes输出
signups_index GET /signups(.:format) signups#index
POST /signups(.:format) signups#create
new_signups GET /signups/new(.:format) signups#new
edit_signups GET /signups/:id/edit(.:format) signups#edit
signups GET /signups/:id(.:format) signups#show
PATCH /signups/:id(.:format) signups#update
PUT /signups/:id(.:format) signups#update
DELETE /signups/:id(.:format) signups#destroy
知道什么可能导致这个模型改变了它的路径名?
答案 0 :(得分:1)
将inflect.irregular('signup', 'signups')
添加到config/initializers/inflections.rb