Module: DeviseHelper

Defined in:
app/helpers/devise_helper.rb

Instance Method Summary collapse

Instance Method Details

#devise_error_messages!Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/devise_helper.rb', line 2

def devise_error_messages!
  return "" if resource.errors.empty?

  messages = resource.errors.full_messages.map { |msg| (:li, msg) }.join
  sentence = "#{pluralize(resource.errors.count, "error")} prohibited this #{resource_name} from being saved:"

  html = <<-HTML
  <div id="error_explanation">
    <h2>#{sentence}</h2>
    <ul>#{messages}</ul>
  </div>
  HTML

  html.html_safe
end