Module: Elastify::ActiveRecordExtensions::LocalMethods
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/elastify/active_record_extensions.rb
Instance Method Summary collapse
Instance Method Details
#elastify_create ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/elastify/active_record_extensions.rb', line 40 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.).create(self.elastify_serialized_document) end end end end |
#elastify_destroy ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/elastify/active_record_extensions.rb', line 60 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.).destroy(self.elastify_serialized_document) end end end end |
#elastify_update ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/elastify/active_record_extensions.rb', line 50 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.).update(self.elastify_serialized_document) end end end end |