Radrails and date in mysql problem


#1

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


#2

help


#3

It would help if you showed us the code you are using to generate the
drop-down list…


#4

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/Helpers/DateHelper.html#M000587)
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 :wink:

regards,

javier ramirez

Estamos de estreno… si necesitas llevar el control de tus gastos
visita http://www.gastosgem.com !!Es gratis!!