Module: MappedRecord::InstanceMethods

Defined in:
lib/mapped-record.rb

Instance Method Summary collapse

Instance Method Details

#update_with(hash = {}, named_mapping = nil) ⇒ Object

Accepts a hash to map and update the object with.



195
196
197
198
199
200
201
202
203
204
205
# File 'lib/mapped-record.rb', line 195

def update_with(hash = {}, named_mapping = nil)
  named_mapping = self.class.class_name unless named_mapping

  self.attributes = self.class.with_attributes(named_mapping, hash)

  if !self.changes.blank?
    self.save
  else
    false
  end
end