您好,我在我的观点中使用gem 'carmen-rails',我写了这篇文章
<%= f.country_select :country, prompt: 'Please select a country',
:id=>'curr-country' %>但它不接受这个id 'curr-country‘。请指导如何在这里提供id。提前谢谢。
发布于 2015-06-11 18:34:03
您必须使用HTML选项传递第二个散列:
<%= f.country_select :country,
{ prompt: 'Please select a country' },
{ id: 'curr-country' } %>carmen-rails gem没有显式地记录这一点(它记录在in code中)。但是,Usage section of the README中的country_select gem确实提供了一个这样的示例
发布于 2015-06-11 18:34:18
<%= f.country_select :country, {id: 'curr-country', prompt: 'Please select a country'} %>尝尝这个
发布于 2015-06-11 19:50:32
尝尝这个
<%= f.country_select :country, {priority: %w(US CA)}, {prompt: 'Please select a country'}, {:id => 'your-id'} %>希望这能对你有所帮助。
https://stackoverflow.com/questions/30778140
复制相似问题