Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10551 (new defect)

Opened 2 years ago

Last modified 9 months ago

[PATCH] date_select is not working with auto_prefix (object[])

Reported by: rickm Assigned to: core
Priority: normal Milestone: 2.0.3
Component: ActionPack Version: 2.0.1
Severity: normal Keywords:
Cc:

Description

When I do the following, I get what I expect for the text_field portion, but not for the date_select portion.

<%# fields_for "child[]", Interest.new do |f|%>
  <%= f.text_field :name %>
  <%= f.date_select :birth %>  
<%# end %>
<input id="child__name" name="child[][name]" size="30" type="text" />
<select id="child_birth_1i" name="child[birth(1i)]">
...
</select>
<select id="child_birth_2i" name="child[birth(2i)]">
...
</select>
<select id="child_birth_3i" name="child[birth(3i)]">
...
</select>

The name for the select fields should be child[][birth(*i)] instead of child[birth(*i)] causing this error message:

Conflicting types for parameter containers. Expected an instance of Hash but found an instance of Array. This can be caused by colliding Array and Hash parameters like qs[]=value&qs[key]=value.

Attachments

patch.diff (3.7 kB) - added by rickm on 12/19/07 14:09:14.

Change History

12/18/07 17:05:35 changed by rickm

Ignore the <%# in the first batch of code. Left the #s in there by mistake. :)

12/19/07 12:40:39 changed by rickm

  • summary changed from date_select is not working with auto_prefix (object[]) to [PATCH] date_select is not working with auto_prefix (object[]).

Patch to fix is attached along with testcase. Feel free to clean up or modify as you wish. (First patch here, go easy on me ;) )

12/19/07 14:06:56 changed by chuyeow

Seems like your patch didn't get attached properly.

12/19/07 14:09:14 changed by rickm

  • attachment patch.diff added.

12/19/07 14:09:36 changed by rickm

Whoops. I do the same with e-mails.

04/01/08 11:22:17 changed by truckle

+1

09/23/08 07:23:49 changed by jamezilla

+1