路由到非RESTfull控制器

时间:2017-03-26 13:40:08

标签: ruby-on-rails ruby-on-rails-5 rails-routing

假设我有一个名为HomeController的控制器,我不打算将它用作RESTful资源,如何以批量方式定义到该控制器的路由?例如:

controller :home do
  collection do
    get   :dashboard
  end
end

1 个答案:

答案 0 :(得分:0)

resources :home, only: [] do 
  collection do 
    get 'dashboard'
    get 'another_dashboard'
  end
end