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



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

def elastify_create
    run_callbacks(:elastify_sync) do
        unless 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



77
78
79
80
81
82
83
84
85
# File 'lib/elastify/active_record_extensions.rb', line 77

def elastify_destroy
    run_callbacks(:elastify_sync) do
        unless 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



67
68
69
70
71
72
73
74
75
# File 'lib/elastify/active_record_extensions.rb', line 67

def elastify_update
    run_callbacks(:elastify_sync) do
        unless 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