Hello,
I have a routes question regarding defaults. If I have a route defined
as follows...
map.connect ''events/:year/:month'',
:controller => ''events'',
:action => ''index'',
:defaults => {
:year => Date.today.year,
:month => Date.today.month
}
and I generate a route with these options...
{:controller => ''events'', :action =>
''index'', :year => Date.today.year,
:month => Date.today.month}
The resulting url is "/events" and doesn''t include the year
and month.
I want the url to include the year and the month ("/events/2007/11"),
but still use the defaults if they''re not provided for use in my
controller.
Basically, if I supply the additional parameters, I want them in the
generated url and if I don''t include the additional parameters,
I''d
still like the defaults to be set for my action.
Is this possible with routes or do I have to check the params in the
action myself and set the proper defaults if they don''t exist?
Thanks,
Andrew
--
Posted via http://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---