Sha256: 5483e451e8ecea6fb47dfe8110055f8ae1703685698c25c77344fed341a1a748
Contents?: true
Size: 1.02 KB
Versions: 163
Compression:
Stored size: 1.02 KB
Contents
# encoding: utf-8 module Mongoid # :nodoc: module Relations #:nodoc: module Cascading #:nodoc: class Nullify attr_accessor :document, :relation, :metadata # Initialize the new cascade strategy, which will set up the relation # and the metadata. # # @example Instantiate the strategy # Strategy.new(document, metadata) # # @param [ Document ] document The document to cascade from. # @param [ Metadata ] metadata The relation's metadata. # # @return [ Strategy ] The new strategy. def initialize(document, metadata) @document, @metadata = document, metadata @relation = document.send(metadata.name) end # This cascade does not delete the referenced relations, but instead # sets the foreign key values to nil. # # @example Nullify the reference. # strategy.cascade def cascade relation.nullify if relation end end end end end
Version data entries
163 entries across 71 versions & 3 rubygems