【问题标题】:Using state_select gem使用 state_select gem
【发布时间】:2012-11-22 01:03:15
【问题描述】:

我正在尝试在我的表单中使用 state_select gem。它给了我下拉菜单并说 状态,但没有选项可供选择。

<div class="field">
    <%= f.label :state %><br />
    <%= f.state_select :state, 'US', { :prompt => "State" }, { :style => "width: 75px;" } %>
  </div>

【问题讨论】:

    标签: ruby-on-rails-3.1 gem form-helpers


    【解决方案1】:

    尝试使用这种格式

    state_select(object, method, country = "US", options = {}, html_options = {})
    

    你试试这个并使用your-object-name 并传递你的options

    <%= state_select(your-object-name, :state, country => 'US', options => {}, { :style => "width: 75px;" }) %>
    

    来源http://rubydoc.info/gems/state_select/0.1.0/frames

    【讨论】:

      猜你喜欢
      • 2019-12-08
      • 2012-01-19
      • 1970-01-01
      • 2015-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      相关资源
      最近更新 更多