module Elasticsearch::Persistence::Model::Callbacks

Public Instance Methods

circuit_breaker_callbacks() click to toggle source
# File lib/elasticsearch/persistence/model/callbacks.rb, line 18
def circuit_breaker_callbacks
  instance_variable_get("@_circuit_breaker_callbacks") || []
end
query_must_have(*args, &block) click to toggle source
# File lib/elasticsearch/persistence/model/callbacks.rb, line 22
def query_must_have(*args, &block)
  options = args.extract_options!

  cb = block_given? ? block : options[:validate_with]

  options[:message] = "does not exist in #{options[:in]}." unless options.has_key? :message

  instance_variable_get("@_circuit_breaker_callbacks") << {name: args.first, options: options, callback: cb}

end