Haml 带有错误的Rails字段和引导4垂直形式

Haml 带有错误的Rails字段和引导4垂直形式,haml,ruby-on-rails-5,bootstrap-4,Haml,Ruby On Rails 5,Bootstrap 4,我有一个简单的rails 5表单,用于使用Bootstrap4进行垂直对齐的新建/编辑。在我出错之前,一切看起来都很好。带有错误的.field\u正在破坏对齐 一旦引入带有错误的字段,\u,.col-x-x选择器似乎就会被忽略。我知道Bootstrap4仍在alpha中,但希望有人能找到解决方案 表格如下: .container.wow.fadeInUp{style: "visibility: visible; animation-name: fadeInUp;"} %h2.state Ne

我有一个简单的rails 5表单,用于使用Bootstrap4进行垂直对齐的新建/编辑。在我出错之前,一切看起来都很好。带有错误的
.field\u
正在破坏对齐

一旦引入带有错误的字段,\u,.col-x-x选择器似乎就会被忽略。我知道Bootstrap4仍在alpha中,但希望有人能找到解决方案

表格如下:

.container.wow.fadeInUp{style: "visibility: visible; animation-name: fadeInUp;"}
  %h2.state New State
  .w-75
    = errors_for(@state)
    .card
      = form_for [:admin, @state] do |f|
        .card-block
          .form-group.row
            = f.label :name, class: 'col-sm-4 col-form-label'
            .col-sm-5
              = f.text_field :name, class: 'form-control'
          .form-group.row
            .col-sm-3
              = f.submit "Save", class: 'btn btn-primary'

您可以删除带有中断css的\u error div的字段\u

这里有一个简单的诀窍,可以一劳永逸地去掉那些讨厌的包装纸。只需将此块添加到config/environment.rb文件中

ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
  html_tag.html_safe
end