Sha256: b1d7d32360cedcf98fa142e2e5e1c323aef075b68b3287c32c6f65bee169f049

Contents?: true

Size: 454 Bytes

Versions: 7

Compression:

Stored size: 454 Bytes

Contents

module Mongoid
  module Elasticsearch
    module Indexing
      extend ActiveSupport::Concern
      included do
        def as_indexed_json
          serializable_hash.reject { |k, v| %w(_id c_at u_at created_at updated_at).include?(k) }
        end

        def es_update
          if destroyed?
            self.class.es.remove_item(self)
          else
            self.class.es.index_item(self)
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mongoid-elasticsearch-0.3.5 lib/mongoid/elasticsearch/indexing.rb
mongoid-elasticsearch-0.3.4 lib/mongoid/elasticsearch/indexing.rb
mongoid-elasticsearch-0.3.3 lib/mongoid/elasticsearch/indexing.rb
mongoid-elasticsearch-0.3.2 lib/mongoid/elasticsearch/indexing.rb
mongoid-elasticsearch-0.3.1 lib/mongoid/elasticsearch/indexing.rb
mongoid-elasticsearch-0.3.0 lib/mongoid/elasticsearch/indexing.rb
mongoid-elasticsearch-0.2.1 lib/mongoid/elasticsearch/indexing.rb