diff --git a/lib/rbs_rails/active_record.rb b/lib/rbs_rails/active_record.rb index f260497..5f47d90 100644 --- a/lib/rbs_rails/active_record.rb +++ b/lib/rbs_rails/active_record.rb @@ -85,6 +85,20 @@ 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}] + + def build: (?ActiveRecord::Associations::CollectionProxy::_EachPair attributes) ?{ () -> untyped } -> #{klass_name} + | (Array[ActiveRecord::Associations::CollectionProxy::_EachPair] attributes) ?{ () -> untyped } -> Array[#{klass_name}] + def create: (?ActiveRecord::Associations::CollectionProxy::_EachPair attributes) ?{ () -> untyped } -> #{klass_name} + | (Array[ActiveRecord::Associations::CollectionProxy::_EachPair] attributes) ?{ () -> untyped } -> Array[#{klass_name}] + def create!: (?ActiveRecord::Associations::CollectionProxy::_EachPair attributes) ?{ () -> untyped } -> #{klass_name} + | (Array[ActiveRecord::Associations::CollectionProxy::_EachPair] attributes) ?{ () -> untyped } -> Array[#{klass_name}] + def reload: () -> Array[#{klass_name}] + + def replace: (Array[#{klass_name}]) -> void + def delete: (*#{klass_name} | #{pk_type}) -> Array[#{klass_name}] + def destroy: (*#{klass_name} | #{pk_type}) -> Array[#{klass_name}] + def <<: (*#{klass_name} | Array[#{klass_name}]) -> self + def prepend: (*#{klass_name} | Array[#{klass_name}]) -> self end RBS end diff --git a/test/expectations/user.rbs b/test/expectations/user.rbs index d317140..59bc17f 100644 --- a/test/expectations/user.rbs +++ b/test/expectations/user.rbs @@ -252,5 +252,19 @@ class User < ::ApplicationRecord class ActiveRecord_Associations_CollectionProxy < ::ActiveRecord::Associations::CollectionProxy include ::User::GeneratedRelationMethods include ::_ActiveRecord_Relation[::User, ::Integer] + + def build: (?ActiveRecord::Associations::CollectionProxy::_EachPair attributes) ?{ () -> untyped } -> ::User + | (Array[ActiveRecord::Associations::CollectionProxy::_EachPair] attributes) ?{ () -> untyped } -> Array[::User] + def create: (?ActiveRecord::Associations::CollectionProxy::_EachPair attributes) ?{ () -> untyped } -> ::User + | (Array[ActiveRecord::Associations::CollectionProxy::_EachPair] attributes) ?{ () -> untyped } -> Array[::User] + def create!: (?ActiveRecord::Associations::CollectionProxy::_EachPair attributes) ?{ () -> untyped } -> ::User + | (Array[ActiveRecord::Associations::CollectionProxy::_EachPair] attributes) ?{ () -> untyped } -> Array[::User] + def reload: () -> Array[::User] + + def replace: (Array[::User]) -> void + def delete: (*::User | ::Integer) -> Array[::User] + def destroy: (*::User | ::Integer) -> Array[::User] + def <<: (*::User | Array[::User]) -> self + def prepend: (*::User | Array[::User]) -> self end end