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
11155
(-- --)
January 11, 2010, 6:01pm
2
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,
You are absolutely right.