class ThinkingSphinx::Configuration::MinimumFields

Attributes

indices[R]

Public Class Methods

new(indices) click to toggle source
# File lib/thinking_sphinx/configuration/minimum_fields.rb, line 2
def initialize(indices)
  @indices = indices
end

Public Instance Methods

reconcile() click to toggle source
# File lib/thinking_sphinx/configuration/minimum_fields.rb, line 6
def reconcile
  return unless no_inheritance_columns?

  sources.each do |source|
    source.fields.delete_if do |field|
      field.name == 'sphinx_internal_class_name'
    end
  end
end

Private Instance Methods

no_inheritance_columns?() click to toggle source
# File lib/thinking_sphinx/configuration/minimum_fields.rb, line 20
def no_inheritance_columns?
  indices.select { |index|
    index.model.column_names.include?(index.model.inheritance_column)
  }.empty?
end
sources() click to toggle source
# File lib/thinking_sphinx/configuration/minimum_fields.rb, line 26
def sources
  @sources ||= @indices.select { |index|
    index.respond_to?(:sources)
  }.collect(&:sources).flatten
end