造型'collection_radio_buttons'

1 ruby styles ruby-on-rails twitter-bootstrap

我可以设置这些样式,以便在集合中的每个单选按钮之间出现换行符吗?

f.collection_radio_buttons(
  :chosen,
  [['A1', 1],['A2', 2], ['A3', 3]],
  :last,
  :first,
  html_options: { class: 'form-control' }
)
Run Code Online (Sandbox Code Playgroud)

psa*_*tos 5

我无法测试,但我认为这有助于:

<%= f.collection_radio_buttons(:chosen, [['A1', 1],['A2', 2], ['A3', 3]], :last, :first, html_options: { class: 'form-control' }) do |b| %>
    <%= b.label { b.radio_button + " " + b.text } %><br>
<% end %>
Run Code Online (Sandbox Code Playgroud)