【问题标题】:Radio Buttons 1 - 10 : With Simple Form单选按钮 1 - 10:简单形式
【发布时间】:2014-04-25 03:21:38
【问题描述】:

我需要一个包含选项 1-10 的 simple_form。我正在尝试以下操作:

 <%= f.collection_radio_buttons :cost, [1..10] %>

【问题讨论】:

    标签: forms ruby-on-rails-4 radio-button simple-form


    【解决方案1】:

    假设这也可以。

    <%= f.input :cost, collection: (1..10), as: :radio_buttons, boolean_style: :inline %>
    

    【讨论】:

      【解决方案2】:

      这么简单:

       <%= f.input :cost, collection: [1,2,3,4,5,6,7,8,9,10], as: :radio_buttons, boolean_style: :inline %>
      

      【讨论】:

        猜你喜欢
        • 2017-11-07
        • 1970-01-01
        • 1970-01-01
        • 2017-02-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-04-15
        • 1970-01-01
        相关资源
        最近更新 更多