I have a wildcard route set up - but I cannot get the built in helpers to generate the correct url.
routes.rb
resources :projects do
patch 'do/*action', to: 'projects#do', as: 'do'
end
rake routes
project_do PATCH /projects/:project_id/do/*action(.:format) projects#do
which looks ok, but my helper project_do_path(project)
generates /projects/1234/do/do
1) why how do I get rid of the second do
2) can I configure it to include the action in the helper?
I have read http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
but it does not talk about helpers in the wildcard section.
thanks and best regards
Having the following routes
resources :blog, only: [:index, :show] do
patch 'do/*do_action', to: 'rsvps#index', as: :do
end
gives me the following url
blog_do PATCH /blog/:blog_id/do/*do_action(.:format) rsvps#index
blog_index GET /blog(.:format) blog#index
blog GET /blog/:id(.:format) blog#show
blog_do_path
now requires 2 arguments
blog_do_path(project, 'asd')
then in your controller action, params[:do_action]
will be 'asd'