Sha256: c3f43ff0eef99fc2f82c8dcfbcbf7ab401c5e74275f8383725dbf700411ecbc4

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

# active_record_5.2.1_ruby_2/join_association.rb

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

3 entries across 3 versions & 3 rubygems

Version Path
polyamorous-2.3.0 lib/polyamorous/activerecord_5.2.1_ruby_2/join_association.rb
ransack-2.3.0 polyamorous/lib/polyamorous/activerecord_5.2.1_ruby_2/join_association.rb
temp_poly-2.1.1a lib/polyamorous/activerecord_5.2.1_ruby_2/join_association.rb