goodwill
2008-Jun-25 15:09 UTC
Bug at datetime_select when used with object[] to submit multiple model
It seems like something is wrong with the datetime_select helper. the helper does not generate name as object[][field(1i)], instead it generates object[field(1i)], which results a 500 error as follows: 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. (The parameters received were [{"name"=>"", "description"=>""}].) I have tested both date_select and datetime_select suffer from the same issue, anyone can confirm that? --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
goodwill
2008-Jun-25 15:10 UTC
Re: Bug at datetime_select when used with object[] to submit multiple model
To let everyone understand the issue clearly, here is the sample: <% form_for "task[]", @task,:url=>{:action=>''save_create_multi''} do | form| %> <% (1..10).each do %> <p> <%= form.label :name, "Name"%> <%= form.text_field :name %> <%= form.label :description, "Description"%> <%= form.text_field :description %> <%= form.label :due_date %> <%= form.date_select :due_date %> </p> <% end %> <%= form.submit ''Save'' %> <% end %> And the generated HTML: <p> <label for="task__name">Name</label> <input id="task__name" name="task[][name]" size="30" type="text" /><label for="task__description">Description</label> <input id="task__description" name="task[][description]" size="30" type="text" /> <label for="task__due_date">Due date</label> <select id="task_due_date_1i" name="task[due_date(1i)]"> <option value="2003">2003</option> ... Notice the due_date part does not have the extra empty square bracket. On Jun 25, 11:09 pm, goodwill <william.yeung...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> It seems like something is wrong with the datetime_select helper. the > helper does not generate name as object[][field(1i)], instead it > generates object[field(1i)], which results a 500 error as follows: > > 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. (The > parameters received were [{"name"=>"", "description"=>""}].) > > I have tested both date_select and datetime_select suffer from the > same issue, anyone can confirm that?--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---