lib/elasticsearch/model/indexing.rb in elasticsearch-model-5.1.0 vs lib/elasticsearch/model/indexing.rb in elasticsearch-model-6.0.0.pre
- old
+ new
@@ -395,10 +395,10 @@
# @return [Hash] The response from Elasticsearch
#
# @see http://rubydoc.info/gems/elasticsearch-api/Elasticsearch/API/Actions:update
#
def update_document(options={})
- if attributes_in_database = self.instance_variable_get(:@__changed_model_attributes)
+ if attributes_in_database = self.instance_variable_get(:@__changed_model_attributes).presence
attributes = if respond_to?(:as_indexed_json)
self.as_indexed_json.select { |k,v| attributes_in_database.keys.map(&:to_s).include? k.to_s }
else
attributes_in_database
end