Reputation: 962
I am putting a randomize def in my controller and would like to access it with a restful route. The route should be accessed with the following:
<%= link_to "Randomize", random_reader_path %>
But I cannot figure out how to get this route to appear in rake routes or configure it correctly in my routes.rb file.
The random method will do the same thing as index only provide a random page content @variable
Currently I have my reader Controller as
resources :reader
in my routes.rb
Upvotes: 0
Views: 273
Reputation: 6397
resources :reader do
get 'random', on: :collection
end
The route will be random_readers_path
, though.
Upvotes: 2