All,

I have numerous places in my codebase like this:

redirect_to :action => 'schedule_by_uid_and_run_date', :uid => @schedule.first.train_uid, :year => @date.year, :month => @date.month, :day => @date.day

I'd like to replace the :year, :month and :day parameters with a hash containing the three parameters. @date is an instance of a Date class, and the trouble with that is Date.month is a single character. I'd like it to be null-padded, but it seems messy to put .rjust(2, '0') against all three parameters everywhere in the code.

Is it possible to do something like this?

redirect_to :action => 'foo', :uid => @schedule.first.train_uid, params_hash

...where params_hash contains { :year => '2011', :month => '01', :day => '19' }

Cheers,


Peter


--
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to