Forum: Ruby on Rails Radrails and date in mysql problem

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.
Alex M. (Guest)
on 2007-04-13 00:23
Hi,

Im using radrails and mysql database, im using DATE in mysql for a date
of birth column,

When i use this in Radrails the date shows as dropdown lists, the days
and month are fine but the year list only shows 2002-2012.

Is there any way of extending the years? as its not suitable for date of
birth.


Any help appreciated
Alex M. (Guest)
on 2007-04-13 12:23
help
Dave G. (Guest)
on 2007-04-13 12:28
(Received via mailing list)
It would help if you showed us the code you are using to generate the
drop-down list...
javier ramirez (Guest)
on 2007-04-13 12:58
(Received via mailing list)
> Im using radrails and mysql database, im using DATE in mysql for a date of birth column, 
When i use this in Radrails the date shows as dropdown lists, the days and month are fine 
but the year list only shows 2002-2012.
>
i was a bit misleaded because of the mysql bit, but after reading your
mail twice i'd say the db has nothing to do with this problem and your
problem is about date_select

under this assumption, i would recommend to read through the date_select
documentation, specially where it says " It's possible to tailor the
selects through the options hash, which accepts all the keys that each
of the individual select builders do (like :use_month_numbers for
select_month
<http://api.rubyonrails.com/classes/ActionView/Help...)
as well as a range of discard options"

then if you go to the "select_year" doc you will see a couple of
interesting options: :start_year and :end_year.

so.. if you provide date_select with these two options, you can
constraint the date range to use instead of going with the default
(which is 5 years before/after the given date).

For future questions to the list i'd recommend to post the code where
you have the problem, that way no assumptions about what you are doing
are needed ;)

regards,

javier ramirez

--
--------
Estamos de estreno... si necesitas llevar el control de tus gastos
visita http://www.gastosgem.com !!Es gratis!!
This topic is locked and can not be replied to.