Sha256: 3748c8cbe3345c4e2b0a9b55bb49086818f1df7ff8fd75a4648de720f6da0d6d

Contents?: true

Size: 321 Bytes

Versions: 3

Compression:

Stored size: 321 Bytes

Contents

class ::ArticleWithDynamicIndexName < ActiveRecord::Base
  include Elasticsearch::Model
  include Elasticsearch::Model::Callbacks

  def self.counter=(value)
    @counter = 0
  end

  def self.counter
    (@counter ||= 0) && @counter += 1
  end

  mapping    { indexes :title }
  index_name { "articles-#{counter}" }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
elasticsearch-model-6.1.2 spec/support/app/article_with_dynamic_index_name.rb
elasticsearch-model-6.1.1 spec/support/app/article_with_dynamic_index_name.rb
elasticsearch-model-6.1.0 spec/support/app/article_with_dynamic_index_name.rb