I am trying to generate a path for a route with requirements. The
route looks like this...
map.courses_image_cache ''/courses/image_cache'',
:controller => ''courses'', :action =>
''image_cache'',
:requirements => {
:cache_id => /\d{8}-\d{4}-\d{5}-\d{4}/,
:filename => /[a-zA-Z0-9_ ]+\.(jpg|jpeg|png|gif){1}/i }
And I call it as
courses_image_cache_path(:cache_id =>
''20100111-0332-76263-6402'', :filename =>
''letter.png'' )
But the result is the path
"/courses/image_cache"
Why does the result NOT include the params?
The params match, but no params in the resulting URL... or is that
intentional, like the keys to the kingdom?
Ideas? Help?
Martin
--
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.
Marnen Laibow-Koser
2010-Jan-11 18:01 UTC
Re: Generating a path from a route with requirements
Martin Streicher wrote:> I am trying to generate a path for a route with requirements. The > route looks like this... > > map.courses_image_cache ''/courses/image_cache'', > :controller => ''courses'', :action => ''image_cache'', > :requirements => { > :cache_id => /\d{8}-\d{4}-\d{5}-\d{4}/, > :filename => /[a-zA-Z0-9_ ]+\.(jpg|jpeg|png|gif){1}/i } > > And I call it as > > courses_image_cache_path(:cache_id => > ''20100111-0332-76263-6402'', :filename => ''letter.png'' ) > > But the result is the path > "/courses/image_cache" > > Why does the result NOT include the params?Because the route has no way of knowing where you wanted the params. Perhaps you wanted ''/courses/image_cache/:filename/:cache_id'' in your map statement?> > The params match, but no params in the resulting URL... or is that > intentional, like the keys to the kingdom? > > Ideas? Help? > > MartinBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. --00163645889ab0f228047ce75456 Content-Type: text/plain; charset=ISO-8859-1 -- 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. --00163645889ab0f228047ce75456--
Martin Streicher
2010-Jan-11 18:04 UTC
Re: Generating a path from a route with requirements
You are absolutely right. On Jan 11, 1:01 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Martin Streicher wrote: > > I am trying to generate a path for a route with requirements. The > > route looks like this... > > > map.courses_image_cache ''/courses/image_cache'', > > :controller => ''courses'', :action => ''image_cache'', > > :requirements => { > > :cache_id => /\d{8}-\d{4}-\d{5}-\d{4}/, > > :filename => /[a-zA-Z0-9_ ]+\.(jpg|jpeg|png|gif){1}/i } > > > And I call it as > > > courses_image_cache_path(:cache_id => > > ''20100111-0332-76263-6402'', :filename => ''letter.png'' ) > > > But the result is the path > > "/courses/image_cache" > > > Why does the result NOT include the params? > > Because the route has no way of knowing where you wanted the params. > Perhaps you wanted ''/courses/image_cache/:filename/:cache_id'' in your > map statement? > > > > > The params match, but no params in the resulting URL... or is that > > intentional, like the keys to the kingdom? > > > Ideas? Help? > > > Martin > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted viahttp://www.ruby-forum.com/.-- 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.