Sha256: d6afc615bf45af4d5dcd7bb731fd237c0740c8648ab52f221a38602be49b1268

Contents?: true

Size: 632 Bytes

Versions: 9

Compression:

Stored size: 632 Bytes

Contents

class ThinkingSphinx::Configuration::MinimumFields
  def initialize(indices)
    @indices = indices
  end

  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

  attr_reader :indices

  def no_inheritance_columns?
    indices.select { |index|
      index.model.column_names.include?(index.model.inheritance_column)
    }.empty?
  end

  def sources
    @sources ||= @indices.select { |index|
      index.respond_to?(:sources)
    }.collect(&:sources).flatten
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
thinking-sphinx-3.3.0 lib/thinking_sphinx/configuration/minimum_fields.rb
thinking-sphinx-3.2.0 lib/thinking_sphinx/configuration/minimum_fields.rb
thinking-sphinx-3.1.4 lib/thinking_sphinx/configuration/minimum_fields.rb
thinking-sphinx-3.1.3 lib/thinking_sphinx/configuration/minimum_fields.rb
thinking-sphinx-3.1.2 lib/thinking_sphinx/configuration/minimum_fields.rb
thinking-sphinx-3.1.1 lib/thinking_sphinx/configuration/minimum_fields.rb
thinking-sphinx-3.1.0 lib/thinking_sphinx/configuration/minimum_fields.rb
thinking-sphinx-3.0.6 lib/thinking_sphinx/configuration/minimum_fields.rb
thinking-sphinx-3.0.5 lib/thinking_sphinx/configuration/minimum_fields.rb