Forum: Ruby on Rails co usar date_select

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
lumen (Guest)
on 2005-12-05 11:23
(Received via mailing list)
Hello:

I have a problem with dateHelper date_select. I think this is a bug.

In a form, I've to list many objects of type "formacio" that a "persona"
have.

"formacio" object have an "id", two foreing key "centre_id" and
"titulacio_id" and a "finalitza_on" date.

The form have to be used to update attributes of all "formacions" of a
"persona".

In a form I have this code:

<% @persona.formacions.each do |@formacio| %>
  <tr>
  <td>
  <%= select("formacio[]","titulacio_id", @titulacions ,{:include_blank
=> true })  %>
  </td>
  <td>
  <%= select("formacio[]","centre_id",  @centres ,{:include_blank =>
true })  %>
  </td>
  <td>
  <%= date_select("formacio[]", "finalitza_on" ) %> <br>
  </td>
  <td>
  </td>
  <td>
  <%= link_to "Borrar",{ :action => "borrar_formacio", :id => @persona,
:f_id => @formacio } %>
  </td>
  </tr>
  <% end %>


Whell, the indexation with [] go pretty well with "titulacio_id" and
"centre_id" but not with "finalitza_on".

The params generated for two objects "formacio" with ids "25" and "26"
are:

Parameters: {"formacio"=>{
"finalitza_on(2i)"=>"3",
"finalitza_on(3i)"=>"5",
"25"=>{"centre_id"=>"", "titulacio_id"=>"2"},
"26"=>{"centre_id"=>"", "titulacio_id"=>"3"},
"finalitza_on(1i)"=>"1983"},
"commit"=>"Actualitza",
"id"=>"9"
}

But what I need is:

Parameters: {"formacio"=>{
,
"25"=>{ "centre_id"=>"",
        "titulacio_id"=>"2",
	"finalitza_on(2i)"=>"3",
	"finalitza_on(3i)"=>"5",
	"finalitza_on(1i)"=>"1983"
},
"26"=>{ "centre_id"=>"",
        "titulacio_id"=>"3"
	"finalitza_on(2i)"=>"6",
	"finalitza_on(3i)"=>"3",
	"finalitza_on(1i)"=>"1985"
},
"commit"=>"Actualitza",
"id"=>"9"
}

More information about my system:

$ ruby -v
ruby 1.8.4 (2005-10-29) [i486-linux]

$ dpkg -l rails
+++-===================-===================-============================
ii  rails               0.14.3-1            MVC ruby based framework

I'm using mysql on a Debian GNU/linux

$ mysql -V
mysql  Ver 14.7 Distrib 4.1.15, for pc-linux-gnu (i486) using readline
5.0


What's going wrong?
This topic is locked and can not be replied to.