Sha256: 6281a84187a0ee9c0d12d547c81259e197266b253882c04ba22dda43a8d2c47d

Contents?: true

Size: 640 Bytes

Versions: 8

Compression:

Stored size: 640 Bytes

Contents

module Polyamorous
  module JoinAssociationExtensions
    include SwappingReflectionClass
    def self.prepended(base)
      base.class_eval { attr_reader :join_type }
    end

    def initialize(reflection, children, polymorphic_class = nil, join_type = Arel::Nodes::InnerJoin)
      @join_type = join_type
      if polymorphic_class && ::ActiveRecord::Base > polymorphic_class
        swapping_reflection_klass(reflection, polymorphic_class) do |reflection|
          super(reflection, children)
          self.reflection.options[:polymorphic] = true
        end
      else
        super(reflection, children)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ransack-3.1.0 lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb
ransack-3.0.1 lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb
ransack-3.0.0 lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb
ransack-2.6.0 lib/polyamorous/activerecord_6.0_ruby_2/join_association.rb
polyamorous-2.3.2 lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb
polyamorous-2.3.1 lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb
ransack-2.3.2 polyamorous/lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb
ransack-2.3.1 polyamorous/lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb