Reputation: 26660
I have a Rails controller for testing purposes:
class MyTestController < ApplicationController
skip_before_action :verify_authenticity_token
def test1
end
def test2
end
def test3
end
def test4
end
def test5
end
........
end
and following routes:
get '/my_test/test1', to: 'my_test#test1'
get '/my_test/test2', to: 'my_test#test2'
get '/my_test/test3', to: 'my_test#test3'
get '/my_test/test4', to: 'my_test#test4'
get '/my_test/test5', to: 'my_test#test5'
........................................
How to make one route for every future public method of this controller to exclude a need to add one route per method?
Upvotes: 1
Views: 237
Reputation: 51161
This should work:
get '/my_test/:action', controller: 'my_test'
Upvotes: 5