Sha256: 55a1278b78a9ec706de556954f9f8cce407528d4db2345782568ecb24ed03f5c

Contents?: true

Size: 838 Bytes

Versions: 6

Compression:

Stored size: 838 Bytes

Contents

require "active_model"
require "elasticsearch"
require "hashie"
require "searchkick/version"
require "searchkick/index"
require "searchkick/reindex"
require "searchkick/results"
require "searchkick/query"
require "searchkick/search"
require "searchkick/similar"
require "searchkick/model"
require "searchkick/tasks"
require "searchkick/logging" if defined?(Rails)

module Searchkick

  def self.client
    @client ||= Elasticsearch::Client.new(url: ENV["ELASTICSEARCH_URL"])
  end

  @callbacks = true

  def self.enable_callbacks
    @callbacks = true
  end

  def self.disable_callbacks
    @callbacks = false
  end

  def self.callbacks?
    @callbacks
  end
end

# TODO find better ActiveModel hook
ActiveModel::Callbacks.send(:include, Searchkick::Model)
ActiveRecord::Base.send(:extend, Searchkick::Model) if defined?(ActiveRecord)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
searchkick-0.7.4 lib/searchkick.rb
searchkick-0.7.3 lib/searchkick.rb
searchkick-0.7.2 lib/searchkick.rb
searchkick-0.7.1 lib/searchkick.rb
searchkick-0.7.0 lib/searchkick.rb
searchkick-0.6.3 lib/searchkick.rb