My route looks something like this:
resources :posts do
collection do
get :search
end
end
I can create a path to posts with the following:
path = posts_path
How do I create a path to the “search” collection?
The only way I know how to do it is something like this:
search_path = “#{posts_path}/search”
There must be a better way.
To list the configured routes, use
rake routes. The named route for what you are doing above would besearch_posts_path.