I have a controller with a number of actions:
class TestsController < ApplicationController
def find
end
def break
end
def turn
end
en
Just add an answer for future, simple ways of route without CRUD :
resources :tests, only: [] do
collection do
get 'find'
match 'break'
match 'turn'
end
end
# output of rake routes
find_tests GET /tests/find(.:format) tests#find
break_tests /tests/break(.:format) tests#break
turn_tests /tests/turn(.:format) tests#turn
or use namespace instead of resources
namespace :tests do
get 'find'
match 'break'
match 'turn'
end
# output of rake routes
tests_find GET /tests/find(.:format) tests#find
tests_break /tests/break(.:format) tests#break
tests_turn /tests/turn(.:format) tests#turn
for Rails 4. (cause match method has been deprecated in rails 4.x or latest)
resources :tests, only: [] do
collection do
get 'find'
get 'break'
get 'turn'
end
end
use namespace
namespace :tests do
get 'find'
get 'break'
get 'turn'
end