Class: InformantRails::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/informant-rails/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#errorsObject

Returns the value of attribute errors.



3
4
5
# File 'lib/informant-rails/model.rb', line 3

def errors
  @errors
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/informant-rails/model.rb', line 3

def name
  @name
end