Forum: Ruby on Rails date_select() in collection

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.
Jean-Etienne (Guest)
on 2006-06-12 19:20
Hi,

I am doing the following:

<% obj.contracts.each do |@contract| -%>
...
<%= hidden_field("contract[]", :contractor_id, :index =>
@contract.contractor.id) %>
<%= date_select("contract[]", :starting_on, :index =>
@contract.contractor.id) %>
...
<% end -%>

Here are the request parameters:

{"commit"=>"Save", "portfolio"=>{"starting_on(1i)"=>"2006",
"starting_on(2i)"=>"6", "starting_on(3i)"=>"12",
"finishing_on(1i)"=>"2006", "customer_id"=>"1", "finishing_on(2i)"=>"6",
"finishing_on(3i)"=>"12"}, "id"=>"1", "pattern"=>"bala",
"contract"=>{"starting_on(1i)"=>"2006", "starting_on(2i)"=>"6",
"starting_on(3i)"=>"12", "1"=>{"contractor_id"=>"1",
"portfolio_id"=>"1"}, "finishing_on(1i)"=>"2006",
"2"=>{"contractor_id"=>"2", "portfolio_id"=>"1"},
"finishing_on(2i)"=>"6", "finishing_on(3i)"=>"12"}}

As you can see, there are two hash keys "1" and "2", but the dates are
not part of those hashes, but directly on the parent hash "contract".

Is this a bug in date_select helper?

Thank you,
Jean-Etienne D. - http://www.novAgora.hu
Jean-Etienne (Guest)
on 2006-06-13 09:45
It seems that date_select() helper does not take in consideration the
"[]", and does not generate the value properly in the hash...
Anatol P. (Guest)
on 2006-06-13 11:08
Jean-Etienne wrote:
> It seems that date_select() helper does not take in consideration the
> "[]", and does not generate the value properly in the hash...


See ticket http://dev.rubyonrails.org/ticket/3811 in rubyonrails. I am
wonder why *SO USEFUL* patch is ignored by RubyOnRails developers.

Is any chance to solve problem with prefix in select_date()??? Because I
had such problem about 6 month ago and I *HAD TO FIX* this problem by
myself. I even wrote patch and add to RoR trac. But patch from Bob S.
solves this as well as other problems.

So question again. Is any chance that BUG in RoR sources will be fixed
in near future??
This topic is locked and can not be replied to.