Class: ActiveInteraction::Filter::Error
- Inherits:
-
Object
- Object
- ActiveInteraction::Filter::Error
- Defined in:
- lib/active_interaction/filter/error.rb
Overview
A validation error that occurs while processing the filter.
Instance Attribute Summary collapse
-
#filter ⇒ ActiveInteraction::Filter
readonly
The filter the error occured on.
-
#name ⇒ Symbol
readonly
The name of the error.
-
#options ⇒ Hash
readonly
Options passed to the error for error message creation.
-
#type ⇒ Symbol
readonly
The type of error.
Instance Method Summary collapse
-
#initialize(filter, type, name: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(filter, type, name: nil) ⇒ Error
Returns a new instance of Error.
10 11 12 13 14 15 16 17 |
# File 'lib/active_interaction/filter/error.rb', line 10 def initialize(filter, type, name: nil) @filter = filter @name = name || filter.name @type = type @options = {} [:type] = I18n.translate("#{Base.i18n_scope}.types.#{filter.class.slug}") if type == :invalid_type end |
Instance Attribute Details
#filter ⇒ ActiveInteraction::Filter (readonly)
The filter the error occured on.
22 23 24 |
# File 'lib/active_interaction/filter/error.rb', line 22 def filter @filter end |
#name ⇒ Symbol (readonly)
The name of the error.
27 28 29 |
# File 'lib/active_interaction/filter/error.rb', line 27 def name @name end |
#options ⇒ Hash (readonly)
Options passed to the error for error message creation.
32 33 34 |
# File 'lib/active_interaction/filter/error.rb', line 32 def @options end |
#type ⇒ Symbol (readonly)
The type of error.
37 38 39 |
# File 'lib/active_interaction/filter/error.rb', line 37 def type @type end |