Class: ZombieRecord::Restorable::WithDeletedAssociations
- Inherits:
- BasicObject
- Defined in:
- lib/zombie_record/restorable.rb
Overview
Wraps a deleted record and makes sure that any associated record is available even if it is deleted. This is done by intercepting the method calls, checking if the method is an association access, and then ensuring that deleted records are included in the resulting query.
Instance Method Summary collapse
-
#initialize(record) ⇒ WithDeletedAssociations
constructor
A new instance of WithDeletedAssociations.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(record) ⇒ WithDeletedAssociations
Returns a new instance of WithDeletedAssociations.
101 102 103 |
# File 'lib/zombie_record/restorable.rb', line 101 def initialize(record) @record = record end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
105 106 107 |
# File 'lib/zombie_record/restorable.rb', line 105 def method_missing(name, *args, &block) delegate_to_record(name) { @record.public_send(name, *args, &block) } end |