Bug for the day

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!

One Response to “Bug for the day

Leave a Reply