Ruby on rails 3.1 使用state_选择gem
我试图在我的表单中使用state_select gem。它给了我下拉列表,并表示 状态,但没有可选择的选项Ruby on rails 3.1 使用state_选择gem,ruby-on-rails-3.1,gem,form-helpers,Ruby On Rails 3.1,Gem,Form Helpers,我试图在我的表单中使用state_select gem。它给了我下拉列表,并表示 状态,但没有可选择的选项 <div class="field"> <%= f.label :state %><br /> <%= f.state_select :state, 'US', { :prompt => "State" }, { :style => "width: 75px;" } %> </div> “状态
<div class="field">
<%= f.label :state %><br />
<%= f.state_select :state, 'US', { :prompt => "State" }, { :style => "width: 75px;" } %>
</div>
“状态”},{:style=>“宽度:75px;”}%>
尝试使用此格式
state_select(object, method, country = "US", options = {}, html_options = {})
您可以尝试使用对象名称
并传递选项
<%= state_select(your-object-name, :state, country => 'US', options => {}, { :style => "width: 75px;" }) %>
'US',options=>{},{:style=>“width:75px;”})%%>
来源: