Class: Forme::ErrorHandler
- Inherits:
-
Object
- Object
- Forme::ErrorHandler
- Defined in:
- lib/forme.rb
Overview
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.
Instance Method Summary collapse
-
#call(tag, input) ⇒ Object
Return tag with error message span tag after it.
Instance Method Details
#call(tag, input) ⇒ Object
Return tag with error message span tag after it.
1107 1108 1109 1110 1111 1112 |
# File 'lib/forme.rb', line 1107 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 |