ruby-on-rails – rails date_select类不会生效
发布时间:2020-12-17 04:20:28 所属栏目:百科 来源:网络整理
导读:我有以下使用date_select .. %= f.date_select :birthday,:order = [:month,:day],:prompt = { :day = 'Select day',:month = 'Select month' },:html = {:class = "select birthday"} % 但是这个类没有出现在html中.. select id="profile_birthday_2i" name
我有以下使用date_select ..
<%= f.date_select :birthday,:order => [:month,:day],:prompt => { :day => 'Select day',:month => 'Select month' },:html => {:class => "select birthday"} %> 但是这个类没有出现在html中.. <select id="profile_birthday_2i" name="profile[birthday(2i)]"> <select id="profile_birthday_3i" name="profile[birthday(3i)]"> 我也试过.. <%= f.date_select :birthday,:class => "select birthday" %> 那也行不通.有任何想法吗? 解决方法
HTML选项是date_select方法的第四个参数,而不是第三个参数中的键.
从documentation: date_select(object_name,method,options = {},html_options = {}) 所以你想要: f.date_select :birthday,{ :order => [:month,:month => 'Select month' } },{:class => "select birthday"} (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |