class Forme::ErrorHandler

  1. lib/forme/bs3.rb
  2. lib/forme/transformers/error_handler.rb
  3. show all
Superclass: Object

Default error handler used by the library, using an “error” class for the input field and a span tag with an “error_message” class for the error message.

Registered as :default.

Methods

Public Instance

  1. call

Public Instance methods

call (tag, input)

Return tag with error message span tag after it.

[show source]
# File lib/forme/transformers/error_handler.rb, line 13
def call(tag, input)
  attr = input.opts[:error_attr]
  attr = attr ? attr.dup : {}
  Forme.attr_classes(attr, 'error_message')
  [tag, input.tag(:span, attr, input.opts[:error])]
end