def error_summary(model)
      return nil unless model&.respond_to?(:errors)
      return nil unless model.errors&.any?
      contents = render_alert_message(
          {
              "__The form contains #{model.errors.count} error#{model.errors.count == 1 ? '' : 's'}.__" => model.errors.full_messages
          },
          5
      )

      html = '<div id="error_explanation"><div class="alert alert-danger">' + contents[:text]

      unless contents[:script].blank?
        html += <<-EOS
<script type="text/javascript">
//<![CDATA[
#{contents[:script]}
//]]>
</script>
        EOS
      end

      html += '</div></div>'

      html.html_safe
    end
def error_summary(model)
      return nil unless model&.respond_to?(:errors)
      return nil unless model.errors&.any?
      contents = render_alert_message(
          {
              "__The form contains #{model.errors.count} error#{model.errors.count == 1 ? '' : 's'}.__" => model.errors.full_messages
          },
          5
      )

      html = '<div id="error_explanation"><div class="alert alert-danger">' + contents[:text]

      unless contents[:script].blank?
        html += <<-EOS
<script type="text/javascript">
//<![CDATA[
#{contents[:script]}
//]]>
</script>
        EOS
      end

      html += '</div></div>'

      html.html_safe
    end
Renders the error summary for the specified model.