Exception: Formify::Errors::ValidationError
- Defined in:
- lib/formify/errors/validation_error.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
Attributes inherited from FormError
Instance Method Summary collapse
-
#initialize(form:) ⇒ ValidationError
constructor
A new instance of ValidationError.
Constructor Details
#initialize(form:) ⇒ ValidationError
Returns a new instance of ValidationError.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/formify/errors/validation_error.rb', line 6 def initialize(form:) first_error = form.errors.first @attribute = if first_error.methods.include?(:attribute) first_error.attribute else first_error.first end super( form: form, message: form.errors.(@attribute).first ) end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
4 5 6 |
# File 'lib/formify/errors/validation_error.rb', line 4 def attribute @attribute end |