Home > general > Bug for the day

Bug for the day

September 25th, 2007 Jo Potts Leave a comment Go to comments

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!

Categories: general Tags:
  1. September 25th, 2007 at 12:08 | #1

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

  1. No trackbacks yet.