class ActiveRecord::Base

Public Class Methods

inherited(child) click to toggle source
# File lib/sorbet-rails/railtie.rb, line 31
def inherited(child)
  sbr_old_inherited(child)
  # make the relation classes public so that they can be used for sorbet runtime checks
  child.send(:public_constant, :ActiveRecord_Relation)
  child.send(:public_constant, :ActiveRecord_AssociationRelation)
  child.send(:public_constant, :ActiveRecord_Associations_CollectionProxy)

  relation_type = T.type_alias do
    T.any(
      child.const_get(:ActiveRecord_Relation),
      child.const_get(:ActiveRecord_AssociationRelation),
      child.const_get(:ActiveRecord_Associations_CollectionProxy)
    )
  end
  child.const_set(:RelationType, relation_type)
  child.send(:public_constant, :RelationType)
end
Also aliased as: sbr_old_inherited
sbr_old_inherited(child)
Alias for: inherited