Answers for "rails check box tag"

1

rails check_box_tag

check_box_tag 'receive_email', 'yes', true
# => <input checked="checked" id="receive_email" name="receive_email" type="checkbox" value="yes" />

check_box_tag 'tos', 'yes', false, class: 'accept_tos'
# => <input class="accept_tos" id="tos" name="tos" type="checkbox" value="yes" />

check_box_tag 'eula', 'accepted', false, disabled: true
# => <input disabled="disabled" id="eula" name="eula" type="checkbox" value="accepted" />
Posted by: Guest on February-26-2021
0

checkbox tag in rails

<%= form_tag(medication_select_path, method: 'put', :id => 'medication-select') do %>
  <% @medications.each do |medication| %>
    <%= check_box_tag "medications[]", medication.id  -%>
  <% end %>
<% end %>
Posted by: Guest on June-03-2021

Browse Popular Code Answers by Language