Sha256: 32c86900206ca86c5e0ec5a1903a4fdfe0b4940bff89c177589ebfd76774f977

Contents?: true

Size: 538 Bytes

Versions: 3

Compression:

Stored size: 538 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_index?
          true
        end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wj-mongoid-elasticsearch-0.0.9 lib/mongoid/elasticsearch/indexing.rb
wj-mongoid-elasticsearch-0.0.8 lib/mongoid/elasticsearch/indexing.rb
wj-mongoid-elasticsearch-0.0.7 lib/mongoid/elasticsearch/indexing.rb