Juliusz Gonera
2011-Aug-08  10:04 UTC
[Rails 3.1] Naming and generation of dynamic routes (route globbing)
Hi,
I have such a route:
    get ''projects/:project_id/files/list*path'' =>
"files#list",
format: false, as: :files_list
I want to generate it using files_list_path(@project), but when I use
it I get:
    No route matches
{:controller=>"files", :action=>"list",
:project_id=>#<Project _id:
4e3b137a3a5c9f7027000002>}
The solution I found is to create another normal route:
    get ''projects/:project_id/files/list*path'' =>
"files#list",
format: false
    get ''projects/:project_id/files/list'' =>
"files#list",
as: :files_list
This way files_list_path(@project) generates ''/projects/some_id/files/
list'' and ''/projects/some_id/files/list/something'' is
also matched by
the first route. But honestly it doesn''t seem right to me. Is this
necessary? Am I missing something?
Regards,
Juliusz Gonera
-- 
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.