Rails:多个路由的相同控制器

时间:2017-08-15 13:34:54

标签: ruby-on-rails routes

我有一个包含路由this的ArticleController,路由就像这样

resources :articles

我需要相同的控制器来处理下面的所有CRUD操作

http://localhost:3000/articles

因此,所有文章CRUD操作都应由Article控制器处理上述3条路由。我怎么能这样做?

1 个答案:

答案 0 :(得分:1)

resources :articles
scope '/personal' do
  resources :articles
end
scope '/stuff' do
  resources :articles
end

http://guides.rubyonrails.org/routing.html