Class: MongoMapper::Document::VeneerInterface::InstanceWrapper

Inherits:
Veneer::Base::InstanceWrapper show all
Defined in:
lib/veneer/adapters/mongomapper/instance_wrapper.rb

Instance Attribute Summary

Attributes inherited from Veneer::Base::InstanceWrapper

#instance, #options

Instance Method Summary collapse

Methods inherited from Veneer::Base::InstanceWrapper

#==, #class, #initialize, #method_missing, #update!

Constructor Details

This class inherits a constructor from Veneer::Base::InstanceWrapper

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Veneer::Base::InstanceWrapper

Instance Method Details

#saveObject



13
14
15
16
17
# File 'lib/veneer/adapters/mongomapper/instance_wrapper.rb', line 13

def save
  instance.save
rescue ::Veneer::Errors::BeforeSaveError => e
  handle_before_save_error(e)
end

#save!Object



5
6
7
8
9
10
11
# File 'lib/veneer/adapters/mongomapper/instance_wrapper.rb', line 5

def save!
  instance.save!
rescue ::Veneer::Errors::BeforeSaveError => e
  raise ::Veneer::Errors::NotSaved, e.message
rescue => e
  raise ::Veneer::Errors::NotSaved, e.message
end

#update(*args) ⇒ Object



19
20
21
22
23
# File 'lib/veneer/adapters/mongomapper/instance_wrapper.rb', line 19

def update(*args)
  instance.update(*args)
rescue ::Veneer::Errors::BeforeSaveError => e
  handle_before_save_error(e)
end