Sha256: e92b8d5bfe606a7cdcc5751426b2894baaf4ab3af9a904a0dbefccb1b29e5f0b

Contents?: true

Size: 639 Bytes

Versions: 1

Compression:

Stored size: 639 Bytes

Contents

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

    messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
    sentence = I18n.t("errors.messages.not_saved",
                      :count => resource.errors.count,
                      :resource => resource.class.model_name.human.downcase)

    html = <<-HTML
    <div data-alert id="error_explanation" class="alert-box warning radius">
      <h2>#{sentence}</h2>
      <ul>#{messages}</ul>
    </div>
    HTML

    html.html_safe
  end

  def devise_error_messages?
    resource.errors.empty? ? false : true
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
self_systeem-0.1.0 test/dummy_app/app/helpers/devise_helper.rb