module Polyamorous::JoinAssociationExtensions

Public Class Methods

new(reflection, children, polymorphic_class = nil, join_type = Arel::Nodes::InnerJoin) click to toggle source
Calls superclass method
# File lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb, line 8
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
prepended(base) click to toggle source
# File lib/polyamorous/activerecord_5.2_ruby_2/join_association.rb, line 4
def self.prepended(base)
  base.class_eval { attr_reader :join_type }
end