Module: Elastictastic::Dirty::InstanceMethods

Defined in:
lib/elastictastic/dirty.rb

Instance Method Summary collapse

Instance Method Details

#elasticsearch_doc=(doc) ⇒ Object



79
80
81
82
# File 'lib/elastictastic/dirty.rb', line 79

def elasticsearch_doc=(doc)
  super
  clean_attributes!
end

#save ⇒ Object



74
75
76
77
# File 'lib/elastictastic/dirty.rb', line 74

def save
  super
  clean_attributes!
end

#write_attribute(field, value) ⇒ Object



54
55
56
57
# File 'lib/elastictastic/dirty.rb', line 54

def write_attribute(field, value)
  attribute_will_change!(field)
  super
end

#write_embed(field, value) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/elastictastic/dirty.rb', line 59

def write_embed(field, value)
  attribute_will_change!(field)
  if Array === value
    value.each do |el|
      el.nesting_document = self
      el.nesting_association = field
    end
    super(field, NestedCollectionProxy.new(self, field, value))
  else
    value.nesting_document = self
    value.nesting_association = field
    super
  end
end