What should I do to keep the label of a checkbox on the same line with the checkbox in a rails view containing a form?
Currently the label goes on the next line:
<
The comment on the answer is correct, but it assumes some nuance of understanding about order of elements.
The correct answer is as follows:
<%= f.check_box :terms_of_service %>
<%= f.label :terms_of_service, "I agree to the #{link_to 'Terms of Service', policies_path}.".html_safe
, {class: "checkbox inline"} %>
Two things are necessary:
This is obvious once you see it working, but all the other samples for form_for always have the inputs after the labels and you need to change that up for checkbox.