Bug for the day

September 25th, 2007 by Jo Potts Leave a reply »

If you’ve got a date_select in a partial on a collection and the date in the AR object isn’t being rendered by the date helper (and it defaults to Time.now) then the fix is to pass an :object parameter to the date_select holding the AR object (which is the partial’s local in my case). Got that?

eg

<%= render :partial => 'duck', :collection => @list_of_ducks %>

<%= date_select("duck"+duck.ref, "dob", :object => duck) %>

This one had me trawling the rails source on my hands and knees!

Advertisement

1 comment

  1. Jo Potts says:

    And by the way: the :default option on date_select doesn’t work in 1.2.3

Leave a Reply