Class: Mongoid::Relations::Cascading::Strategy

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/relations/cascading/strategy.rb

Direct Known Subclasses

Delete, Destroy, Nullify

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document, metadata) ⇒ Strategy

Initialize the new cascade strategy, which will set up the relation and the metadata.

Examples:

Instantiate the strategy

Strategy.new(document, )

Parameters:

  • document (Document)

    The document to cascade from.

  • metadata (Metadata)

    The relation’s metadata.



19
20
21
22
# File 'lib/mongoid/relations/cascading/strategy.rb', line 19

def initialize(document, )
  @document, @metadata = document, 
  @relation = document.send(.name)
end

Instance Attribute Details

#documentObject

Returns the value of attribute document.



7
8
9
# File 'lib/mongoid/relations/cascading/strategy.rb', line 7

def document
  @document
end

#metadataObject

Returns the value of attribute metadata.



7
8
9
# File 'lib/mongoid/relations/cascading/strategy.rb', line 7

def 
  @metadata
end

#relationObject

Returns the value of attribute relation.



7
8
9
# File 'lib/mongoid/relations/cascading/strategy.rb', line 7

def relation
  @relation
end