module ActiveRecord::Delegation

def delegated_classes

def delegated_classes
  [
    ActiveRecord::Relation,
    ActiveRecord::Associations::CollectionProxy,
    ActiveRecord::AssociationRelation,
    ActiveRecord::DisableJoinsAssociationRelation,
  ]
end

def respond_to_missing?(method, _)

def respond_to_missing?(method, _)
  super || model.respond_to?(method)
end

def uncacheable_methods

def uncacheable_methods
  @uncacheable_methods ||= (
    delegated_classes.flat_map(&:public_instance_methods) - ActiveRecord::Relation.public_instance_methods
  ).to_set.freeze
end