只是新的轨道,所以想知道这个。有什么特别的原因为什么会这样?我是否必须手动删除每次创建的路由?
我觉得很奇怪。
例如,我这样做:
$ bin/rails generate controller Articles index
create app/controllers/articles_controller.rb
route get 'articles/index'
invoke erb
create app/views/articles
create app/views/articles/index.html.erb
invoke test_unit
create test/controllers/articles_controller_test.rb
invoke helper
create app/helpers/articles_helper.rb
invoke test_unit
字符串
然后这个
$ rails destroy controller Articles
remove app/controllers/articles_controller.rb
invoke erb
remove app/views/articles
invoke test_unit
remove test/controllers/articles_controller_test.rb
invoke helper
remove app/helpers/articles_helper.rb
invoke test_unit
型
但是创建的路由没有被删除routes.rb文件:
Rails.application.routes.draw do
get 'articles/index'
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Defines the root path route ("/")
# root "articles#index"
end
型
1条答案
按热度按时间pgx2nnw81#
因为路由生成器仅在指定操作时调用:
个字符