Sha256: 0a851bdd992a2bae13c4b948470ccbaa8938112258ec0eac169b2219ba01a850

Contents?: true

Size: 653 Bytes

Versions: 17

Compression:

Stored size: 653 Bytes

Contents

# frozen_string_literal: true

class ThinkingSphinx::ActiveRecord::Depolymorph::BaseReflection
  def initialize(reflection, name, class_name)
    @reflection = reflection
    @name       = name
    @class_name = class_name

    @options = reflection.options.clone
  end

  def call
    # Should be implemented by subclasses.
  end

  private

  attr_reader :reflection, :name, :class_name

  def klass
    reflection.class
  end

  def options
    @options.delete :polymorphic
    @options[:class_name]    = class_name
    @options[:foreign_key] ||= "#{reflection.name}_id"
    @options[:foreign_type]  = reflection.foreign_type

    @options
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-5.5.1 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-5.5.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-5.4.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-5.3.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-5.2.1 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-5.2.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-5.1.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-5.0.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-4.4.1 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-4.4.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-4.3.2 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-4.3.1 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-4.3.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-4.2.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-4.1.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb
thinking-sphinx-4.0.0 lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb