class Ransack::Adapters::ActiveRecord::JoinAssociation

def initialize(reflection, join_dependency, parent = nil, polymorphic_class = nil)

def initialize(reflection, join_dependency, parent = nil, polymorphic_class = nil)
  if polymorphic_class && ::ActiveRecord::Base > polymorphic_class
    swapping_reflection_klass(reflection, polymorphic_class) do |reflection|
      super(reflection, join_dependency, parent)
    end
  else
    super(reflection, join_dependency, parent)
  end
end