Ruby on rails 如何在不包围各自标签的情况下(使用f.input)以简单的形式用div包围输入

Ruby on rails 如何在不包围各自标签的情况下(使用f.input)以简单的形式用div包围输入,ruby-on-rails,simple-form,Ruby On Rails,Simple Form,我正在为twitter引导使用一个自定义主题,它以这种方式围绕着div中的输入: = simple_form_for(@user_session) do |f| .control-group = f.label :username, 'Usuario', class: 'control-label' .controls = f.input_field :username 我只想使用f.input保存大型表单中的编码,我运行

我正在为twitter引导使用一个自定义主题,它以这种方式围绕着div中的输入:

    = simple_form_for(@user_session) do |f|
      .control-group
        = f.label :username, 'Usuario', class: 'control-label'
        .controls
          = f.input_field :username
我只想使用f.input保存大型表单中的编码,我运行了rails generate simple_form:install以便能够修改配置,目前我有:

    = simple_form_for(@user_session) do |f|
      = f.input :username, :label => 'Usuario'
它几乎生成了我需要的所有标记(以初始化器/简单_形式添加相应的类):


...
乌萨里奥
...
它只需要一个额外的'div',在输入标记周围有一个类'controls',而不是标签,有什么方法可以实现这一点吗


谢谢

终于找到了方法,以这种方式配置包装器会为引导添加所需的div:

初始值设定项/简单形式

在这里找到了答案:

希望它能帮助别人! 再见

<form action="/user_sessions" class="form-horizontal new_user_session" method="post">
      ...
      <div class="control-group username">
          <label class="username control-label" for="user_session_username">Usuario</label>
          <input class="username" id="user_session_username" name="user_session[username]" size="50" type="text" />
      </div>
      ...
</form>
config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
  b.use :html5
  b.use :placeholder
  b.use :label
  b.wrapper :tag => 'div', :class => 'controls' do |ba|
    ba.use :input
    ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
    ba.use :hint,  :wrap_with => { :tag => 'p', :class => 'help-block' }
  end
end

config.default_wrapper = :bootstrap