Sha256: 99b7e24e8e6608058ea5967b2a0fe279afb4493c18355aff1bd0ec84268ccf03
Contents?: true
Size: 1.07 KB
Versions: 25
Compression:
Stored size: 1.07 KB
Contents
module Elastics module InstanceProxy class ActiveModel < ModelIndexer def store(*vars) return super unless instance.elastics_indexable? # this should never happen since elastics_indexable? returns true meth = (id.nil? || id.empty?) ? :post_store : :put_store Elastics.send(meth, metainfo, {:data => instance.elastics_source}, *vars) end def sync_self instance.instance_eval do if destroyed? if @skip_destroy_callbacks elastics.remove else run_callbacks :destroy do elastics.remove end end else run_callbacks :save do context = new_record? ? :create : :update run_callbacks(context) do result = context == :create ? elastics.store : elastics.store(:params => { :version => _version }) @_id = result['_id'] @_version = result['_version'] end end end end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems