module DeviseHelper
  def devise_error_messages!
    if resource.errors.present?
      content_tag(:div,
        content_tag(:h3, t("errors.messages.not_saved.#{resource.errors.size == 1 ? 'one' : 'other'}", resource: resource.class.model_name.human, count: resource.errors.size)) + 
        content_tag(:ul, resource.errors.full_messages.map{|m| content_tag(:li, m)}.join.html_safe),
        class: 'form-errors'
      )
    end
  end
end
