Simple_form how to make accept terms checkbox inline

Benamir picture Benamir · Oct 24, 2012 · Viewed 8.6k times · Source
<p><%= f.input :terms, :as => :boolean, :label => false, :boolean_style => :inline %> 
Accept <%= link_to "Terms of use", terms_path,:remote => true %> 
and <%=link_to "privacy Policy", privacy_path, :remote => true%></p>

It ends up looking like this

enter image description here

What is the best way to line them up on the same line.

Answer

Jesse Wolgamott picture Jesse Wolgamott · Oct 24, 2012

Here's a rather simple way:

<%= content_for(:the_links) do %>
    Accept <%= link_to "Terms of use", terms_path,:remote => true %> 
    and <%=link_to "privacy Policy", privacy_path, :remote => true%>
<% end %>

<%= simple_form_for @user do |f| %>
  <%= f.input :email %>
  <%= f.input :password %>
  <%= f.input :terms, :as => :boolean, :label => content_for(:the_links)%> 
<% end%>

the-non-styled-output