Class: InformantRails::Model
- Inherits:
-
Struct
- Object
- Struct
- InformantRails::Model
- Defined in:
- lib/informant-rails/model.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
Returns the value of attribute model.
Instance Method Summary collapse
Instance Attribute Details
#model ⇒ Object
Returns the value of attribute model
2 3 4 |
# File 'lib/informant-rails/model.rb', line 2 def model @model end |
Instance Method Details
#as_json(*args) ⇒ Object
13 14 15 |
# File 'lib/informant-rails/model.rb', line 13 def as_json(*args) { name: name, errors: errors.map(&:as_json) } end |
#errors ⇒ Object
7 8 9 10 11 |
# File 'lib/informant-rails/model.rb', line 7 def errors model.errors.map do |field, error| InformantRails::FieldError.new(field.to_s, model[field], error) end end |
#name ⇒ Object
3 4 5 |
# File 'lib/informant-rails/model.rb', line 3 def name model.class.name end |