Class: Forme::ErrorHandler
- Inherits:
-
Object
- Object
- Forme::ErrorHandler
- Defined in:
- lib/forme/transformers/error_handler.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.
Direct Known Subclasses
Defined Under Namespace
Classes: Bootstrap3
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.
13 14 15 16 17 18 |
# 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 |