Module: Elastify::ActiveRecordExtensions::LocalMethods

Extended by:
ActiveSupport::Concern
Defined in:
lib/elastify/active_record_extensions.rb

Instance Method Summary collapse

Instance Method Details

#elastify_createObject



39
40
41
42
43
44
45
46
47
# File 'lib/elastify/active_record_extensions.rb', line 39

def elastify_create
    run_callbacks(:elastify_sync) do
        if not self.elastify_serialized_document.blank?
            run_callbacks(:elastify_create) do
                Elastify::Helpers::ElasticSearch::Document.new(self.class.elastify_options).create(self.elastify_serialized_document)
            end
        end
    end
end

#elastify_destroyObject



59
60
61
62
63
64
65
66
67
# File 'lib/elastify/active_record_extensions.rb', line 59

def elastify_destroy
    run_callbacks(:elastify_sync) do
        if not self.elastify_serialized_document.blank?
            run_callbacks(:elastify_destroy) do
                Elastify::Helpers::ElasticSearch::Document.new(self.class.elastify_options).destroy(self.elastify_serialized_document)
            end
        end
    end
end

#elastify_updateObject



49
50
51
52
53
54
55
56
57
# File 'lib/elastify/active_record_extensions.rb', line 49

def elastify_update
    run_callbacks(:elastify_sync) do
        if not self.elastify_serialized_document.blank?
            run_callbacks(:elastify_update) do
                Elastify::Helpers::ElasticSearch::Document.new(self.class.elastify_options).update(self.elastify_serialized_document)
            end
        end
    end
end