How to route controllers without CRUD actions?

ruby, ruby-on-rails, ruby-on-rails-3

Solution

You can specify actions you want to route like this:

resources :tests, except: [:new, :create, :edit, :update, :destroy] do 
  collection do 
    get 'find'
    get 'break'
    get 'turn'
  end 
end

Problem

I have a controller with a number of actions: ``` class TestsController < ApplicationController def find end def break end def turn end end ``` When I add it to my `routes.rb` file like so: ``` resources :tests ``` and execute the `rake routes` task I see the following extra rounds: ``` tests GET /tests(.:format) tests#index POST /tests(.:format) tests#create new_test GET /tests/new(.:format) tests#new edit_test GET /tests/:id/edit(.:format) tests#edit test GET /tests/:id(.:format) tests#show PUT /tests/:id(.:format) tests#update DELETE /tests/:id(.:format) tests#destroy ``` Obviously my controller doesn't have the above actions. So how do I tell Rails to avoid generating/expecting those routes?

Original source