Simple_form如何使内联接受条件复选框

Ben*_*mir 10 html css ruby-on-rails simple-form twitter-bootstrap

<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>
Run Code Online (Sandbox Code Playgroud)

它最终看起来像这样

在此输入图像描述

在同一条线上排列它们的最佳方法是什么.

Jes*_*ott 23

这是一个相当简单的方法:

<%= 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%>
Run Code Online (Sandbox Code Playgroud)

该基非风格输出