Class: InformantRails::Model
- Inherits:
-
Object
- Object
- InformantRails::Model
- Defined in:
- lib/informant-rails/model.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(model) ⇒ Model
constructor
A new instance of Model.
Constructor Details
#initialize(model) ⇒ Model
Returns a new instance of Model.
5 6 7 8 9 10 |
# File 'lib/informant-rails/model.rb', line 5 def initialize(model) self.name = model.class.name self.errors = model.errors.map do |field, error| InformantRails::FieldError.new(field.to_s, model[field], error) end end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
3 4 5 |
# File 'lib/informant-rails/model.rb', line 3 def errors @errors end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/informant-rails/model.rb', line 3 def name @name end |