views:

23

answers:

1

I understand there is a select_Year but i can't figure out how to use it:

= f.select_year("dob", :start_year => DateTime.now.year, :end_year => DateTime.now.year - 100 )

This is incorrect..how would you actually write this? My attribute is :dob

+1  A: 

Hi try

= f.select_year(Date.today, :start_year => DateTime.now.year, :end_year => DateTime.now.year - 100, :field_name => 'dob' )

EDIT

next one works

select_year(Date.today, {:start_year => DateTime.now.year, :end_year => DateTime.now.year - 100}, {:name => 'card_signup[dob]'})
Bohdan Pohorilets
ahh! field_name! i'm surprised the API had no documentation on such an important field. Thanks!
Trip
@Bohdan, Field_Name is actually incorrect I think. Because it parses as date["dob"], and not myModel["dob"] . What's missing?
Trip
Hmm I ended up going with `= date_select("card_signup", "dob", :end_year => DateTime.now.year - 100, :discard_day => true, :discard_month => true)`
Trip
I suppose if you need such field you should better use date_select("model", "dob", :start_year => DateTime.now.year, :end_year => DateTime.now.year - 100, :discard_month => true, :discard_day => true)
Bohdan Pohorilets
I'm not sure but you also may try select_year(Date.today, {:start_year => DateTime.now.year, :end_year => DateTime.now.year - 100}, {:name => 'card_signup[dob]'} )
Bohdan Pohorilets
That last one turned out right in the HTML, but I guess it was missing something or other because it failed validation as being a blank field. The working one `<select name="card_signup[dob(1i)]" id="card_signup_dob_1i">` , and the non-working one, `<select name="card_signup[dob]" id="date_year">`
Trip