我有以下使用date_select ..
<%= f.date_select :birthday, :order => [:month, :day], :prompt => { :day => 'Select day', :month => 'Select month' }, :html => {:class => "select birthday"} %>
Run Code Online (Sandbox Code Playgroud)
但是这个类没有出现在html中..
<select id="profile_birthday_2i" name="profile[birthday(2i)]">
<select id="profile_birthday_3i" name="profile[birthday(3i)]">
Run Code Online (Sandbox Code Playgroud)
我也试过..
<%= f.date_select :birthday, :order => [:month, :day], :prompt => { :day => 'Select day', :month => 'Select month' }, :class => "select birthday" %>
Run Code Online (Sandbox Code Playgroud)
那也行不通.有任何想法吗?
Dou*_*rer 12
HTML选项是方法的第四个参数date_select,而不是第三个参数中的键.
从文档:
date_select(object_name, method, options = {}, html_options = {})
Run Code Online (Sandbox Code Playgroud)
所以你想要:
f.date_select :birthday, { :order => [:month, :day], :prompt => { :day => 'Select day', :month => 'Select month' } }, {:class => "select birthday"}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5012 次 |
| 最近记录: |