Module: MmPartialUpdate::OneEmbeddedProxy

Defined in:
lib/mm_partial_update/one_embedded_proxy.rb

Instance Method Summary collapse

Instance Method Details

#add_updates_to_command(changes, command) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/mm_partial_update/one_embedded_proxy.rb', line 4

def add_updates_to_command(changes, command)
  selector = association.name
  selector = "#{proxy_owner.database_selector}.#{selector}" if
    proxy_owner.respond_to?(:database_selector)

  if @target.nil?
    command.unset(selector, :nullify=>true) unless changes.blank?
  else
    @target.add_updates_to_command(command)
  end
end

#assign_references(doc) ⇒ Object



16
17
18
19
# File 'lib/mm_partial_update/one_embedded_proxy.rb', line 16

def assign_references(doc)
  doc.instance_variable_set("@_association_name",association.name)
  super(doc)
end