class ThinkingSphinx::ActiveRecord::Callbacks::DeltaCallbacks

Public Instance Methods

after_commit() click to toggle source
# File lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb, line 6
def after_commit
  return unless delta_indices? && processors.any? { |processor|
    processor.toggled?(instance)
  } && !ThinkingSphinx::Deltas.suspended?

  delta_indices.each do |index|
    index.delta_processor.index index
  end

  core_indices.each do |index|
    index.delta_processor.delete index, instance
  end
end
before_save() click to toggle source
# File lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb, line 20
def before_save
  return unless delta_indices?

  processors.each { |processor| processor.toggle instance }
end

Private Instance Methods

config() click to toggle source
# File lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb, line 28
def config
  ThinkingSphinx::Configuration.instance
end
core_indices() click to toggle source
# File lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb, line 32
def core_indices
  @core_indices ||= indices.reject &:delta?
end
delta_indices() click to toggle source
# File lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb, line 36
def delta_indices
  @delta_indices ||= indices.select &:delta?
end
delta_indices?() click to toggle source
# File lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb, line 40
def delta_indices?
  delta_indices.any?
end
indices() click to toggle source
# File lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb, line 44
def indices
  @indices ||= ThinkingSphinx::IndexSet.new [instance.class], []
end
processors() click to toggle source
# File lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb, line 48
def processors
  delta_indices.collect &:delta_processor
end