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:
<div class="span6 offset3">
<%= form_for(@user) do |f| %>
<%= render 'shared/error_messages', object: f.object %>
<%= f.label :name %>
<%= f.text_field :name %>
<br>
<%= f.check_box :terms_of_service %>
<%= f.label :terms_of_service, "I agree to the #{link_to 'Terms of Service', policies_path}.".html_safe %>
<br><br>
<%= f.submit "Create my account", :class => "btn btn-large btn-primary" %>
<% end %>
Thank you, Alexandra
It looks like you're using Bootstrap, so I recommend adapting your view code to use the horizontal form layout described in this section of the Bootstrap docs: https://getbootstrap.com/docs/4.3/components/forms/#horizontal-form