Search code examples
ruby-on-railsruby-on-rails-5rails-routing

routes to non-RESTfull controller


Let's say I have a controller named HomeController and I don't intend to use it as a RESTful resource, how can I define routes to this controller in a bulk manner? e.g something like this:

controller :home do
  collection do
    get   :dashboard
  end
end

Solution

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