pocke / rbs_rails

Apache License 2.0
283 stars 33 forks source link

include Relation to CollectionProxy #189

Closed ksss closed 3 years ago

ksss commented 3 years ago

gem_rbs_collection's _ActiveRecord_Relation emulates ruby class Model::ActiveRecord_Relation's methods.

Then, the class relationship in ruby is as follows. ref: https://github.com/rails/rails/blob/9f02d2d84ac84827b98add4199a7efafd0124eba/activerecord/lib/active_record/relation/delegation.rb#L13-L30

class ActiveRecord::Associations::CollectionProxy < ActiveRecord::Relation
end

class Model
  class ActiveRecord_Relation < ActiveRecord::Relation
  end
  class ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
  end
end

If we expect _ActiveRecord_Relation to emulate ActiveRecord::Relation, then this change will expand the range of possible type support.