Module: Elastify::ActiveRecordExtensions::LocalMethods

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

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#elastify_createObject



46
47
48
49
50
51
52
53
54
# File 'lib/elastify/active_record_extensions.rb', line 46

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

#elastify_destroyObject



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

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

#elastify_updateObject



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

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