Routes 如何删除无关的路由?
我运行了Routes 如何删除无关的路由?,routes,ruby-on-rails-3.2,Routes,Ruby On Rails 3.2,我运行了rake routes,发现了许多不在routes.rb文件中的路由: home_index GET /home(.:format) home#index POST /home(.:format) home#create new_home GET /home/new(.:f
rake routes
,发现了许多不在routes.rb文件中的路由:
home_index GET /home(.:format) home#index
POST /home(.:format) home#create
new_home GET /home/new(.:format) home#new
edit_home GET /home/:id/edit(.:format) home#edit
home GET /home/:id(.:format) home#show
PUT /home/:id(.:format) home#update
DELETE /home/:id(.:format) home#destroy
我手动删除了生成scaffold时创建的文件,但不知道如何彻底清理测试中的混乱
在我的routes.rb文件中,我有:
# define the root
root :to => "home#about"
# define all the possible routes from the home controller
resources :home do
get "about"
get "create_subscription"
end
Rails为使用“资源”声明的任何内容创建许多默认路由。您可以通过在路由文件中使用“:only=>”来解决此问题。请参见本手册第2.2节和第4.6节