Forum: Ruby on Rails select_xxx helper and default value

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.
F61a163fff9b7d4535647bbdaf081681?d=identicon&s=25 fredrikbach (Guest)
on 2006-12-29 14:27
(Received via mailing list)
Hi there,

I am struggling with handling the default day/month/year in the
select_xxx helper methods. I currently have:

<div id="date_day"><%= select_day(nil, :prefix =>
"product_return[exchange_date(3i)]", :discard_type => true,
:include_blank => true) %></div>

As is, the list will (obviously) always default to the blank selection,
but I am hoping for some type of if where if the exchange_date is nil
then nil is "used" (as above) and if exchange_date is not níl (there
is a date in the db), then exchange_date.day is used.

Any help/ideas would be very much appreciated. If I have missed
something really obvious, I apologize.

Thx,
-Fredrik Bach
fredrikbach@gmail.com
This topic is locked and can not be replied to.