Skip to content

Commit

Permalink
Fix #277: CollectionProxy should include Enumerable explicitly
Browse files Browse the repository at this point in the history
To precise the types of enumerable methods of CollectionProxy object,
this adds include statement to the generated CollectionProxy types.

refs: #277
  • Loading branch information
tk0miya committed Nov 10, 2024
1 parent 5f5c8f8 commit 9fe353c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rbs_rails/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class #{relation_class_name(abs: false)} < ::ActiveRecord::Relation
class ActiveRecord_Associations_CollectionProxy < ::ActiveRecord::Associations::CollectionProxy
include #{generated_relation_methods_name}
include ::_ActiveRecord_Relation[#{klass_name}, #{pk_type}]
include ::Enumerable[#{klass_name}]
end
RBS
end
Expand Down
1 change: 1 addition & 0 deletions test/expectations/user.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -252,5 +252,6 @@ class User < ::ApplicationRecord
class ActiveRecord_Associations_CollectionProxy < ::ActiveRecord::Associations::CollectionProxy
include ::User::GeneratedRelationMethods
include ::_ActiveRecord_Relation[::User, ::Integer]
include ::Enumerable[::User]
end
end

0 comments on commit 9fe353c

Please sign in to comment.