I can't seem to figure this out.
I have this :
= date_select("card_signup", "dob", :end_year => DateTime.now.year - 100, :discard_day => true, :discard_month => true)
And I want to include this {:style => "width: 121px;"}
开发者_JAVA技巧But every way I try it fails. Anyone know the syntax?
The date_select
method accepts four arguments, the last two of which (options
and html_options
) are Ruby hashes. Therefore you need to use braces to group the options corresponding to the third method argument so that the method can determine which passed options belong to which parameter.
Try this:
date_select("card_signup", "dob", { :end_year => DateTime.now.year - 100,
:discard_day => true, :discard_month => true },
:style => "width: 121px;")
Given the docs at rubyonrails, it appears the syntax would be something like:
date_select("card_signup", "dob", { :end_year => DateTime.now.year - 100, :discard_day => true, :discard_month => true}, {:style => "width: 121px;"})
Since rails turns trailing arguments into hash for you, you can leave off the final braces:
date_select("card_signup", "dob", { :end_year => DateTime.now.year - 100, :discard_day => true, :discard_month => true}, :style => "width: 121px;")
精彩评论