From eccfa35affdcdbdaa2d0de2b711e33cf2c88ae64 Mon Sep 17 00:00:00 2001 From: Kazuya INOUE Date: Thu, 31 Oct 2024 11:28:19 +0900 Subject: [PATCH 1/3] Add type definitions to delete_all --- gems/activerecord/6.0/activerecord-generated.rbs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gems/activerecord/6.0/activerecord-generated.rbs b/gems/activerecord/6.0/activerecord-generated.rbs index 1d8f722d..7bc30d9c 100644 --- a/gems/activerecord/6.0/activerecord-generated.rbs +++ b/gems/activerecord/6.0/activerecord-generated.rbs @@ -896,7 +896,7 @@ module ActiveRecord # @author.books.delete_all(:delete_all) # # See delete for more info. - def delete_all: (?untyped? dependent) -> untyped + def delete_all: (?Symbol dependent) -> Integer # Destroy all the records from this association. # @@ -1232,7 +1232,7 @@ module ActiveRecord # # Pet.find(1, 2, 3) # # => ActiveRecord::RecordNotFound: Couldn't find all Pets with 'id': (1, 2, 3) - def delete_all: (?untyped? dependent) -> untyped + def delete_all: (?Symbol dependent) -> Integer # Deletes the records of the collection directly from the database # ignoring the +:dependent+ option. Records are instantiated and it @@ -19574,7 +19574,7 @@ module ActiveRecord # # Post.distinct.delete_all # # => ActiveRecord::ActiveRecordError: delete_all doesn't support distinct - def delete_all: () -> untyped + def delete_all: () -> Integer # Finds and destroys all records matching the specified conditions. # This is short-hand for relation.where(condition).destroy_all. From c77e80b8abe68b3f2bdac1de631f2a0d6fae9ddf Mon Sep 17 00:00:00 2001 From: Kazuya INOUE Date: Mon, 18 Nov 2024 08:44:42 +0900 Subject: [PATCH 2/3] Add type definitions to delete_all in gems/activerecord/6.0/activerecord.rbs --- gems/activerecord/6.0/activerecord.rbs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gems/activerecord/6.0/activerecord.rbs b/gems/activerecord/6.0/activerecord.rbs index 043ab19e..f1d3e19a 100644 --- a/gems/activerecord/6.0/activerecord.rbs +++ b/gems/activerecord/6.0/activerecord.rbs @@ -406,7 +406,7 @@ module ActiveRecord def in_batches: (?of: Integer, ?start: Integer, ?finish: Integer, ?load: bool, ?error_on_ignore: bool, ?order: untyped) { (self) -> void } -> nil def sum: (?untyped? column_name) -> Integer def destroy_all: () -> untyped - def delete_all: () -> untyped + def delete_all: (?Hash[Symbol, untyped] conditions) -> Integer def update_all: (*untyped) -> untyped def touch_all: (*untyped, ?time: untyped) -> untyped def destroy_by: (*untyped) -> untyped @@ -494,7 +494,7 @@ module ActiveRecord def in_batches: (?of: Integer, ?start: Integer, ?finish: Integer, ?load: bool, ?error_on_ignore: bool, ?order: untyped) { (Relation) -> void } -> nil def sum: (?untyped? column_name) -> Integer def destroy_all: () -> untyped - def delete_all: () -> untyped + def delete_all: (?Hash[Symbol, untyped] conditions) -> Integer def update_all: (*untyped) -> untyped def touch_all: (*untyped, ?time: untyped) -> untyped def destroy_by: (*untyped) -> untyped @@ -576,7 +576,7 @@ interface _ActiveRecord_Relation[Model, PrimaryKey] def in_batches: (?of: Integer, ?start: Integer, ?finish: Integer, ?load: bool, ?error_on_ignore: bool, ?order: untyped) { (self) -> void } -> nil def sum: (?untyped? column_name) -> Integer def destroy_all: () -> untyped - def delete_all: () -> untyped + def delete_all: (?Hash[Symbol, untyped] conditions) -> Integer def update_all: (untyped) -> untyped def touch_all: (*untyped, ?time: untyped) -> untyped def destroy_by: (*untyped) -> untyped @@ -662,7 +662,7 @@ interface _ActiveRecord_Relation_ClassMethods[Model, Relation, PrimaryKey] def in_batches: (?of: Integer, ?start: Integer, ?finish: Integer, ?load: bool, ?error_on_ignore: bool, ?order: untyped) { (Relation) -> void } -> nil def sum: (?untyped? column_name) -> Integer def destroy_all: () -> untyped - def delete_all: () -> untyped + def delete_all: (?Hash[Symbol, untyped] conditions) -> Integer def update_all: (untyped) -> untyped def touch_all: (*untyped, ?time: untyped) -> untyped def destroy_by: (*untyped) -> untyped From 881a36e98ea754c32a93c66d2707f0781cf305b1 Mon Sep 17 00:00:00 2001 From: Kazuya INOUE Date: Thu, 21 Nov 2024 09:07:47 +0900 Subject: [PATCH 3/3] update only return types without changing arguments --- gems/activerecord/6.0/activerecord.rbs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gems/activerecord/6.0/activerecord.rbs b/gems/activerecord/6.0/activerecord.rbs index f1d3e19a..95ed1ecb 100644 --- a/gems/activerecord/6.0/activerecord.rbs +++ b/gems/activerecord/6.0/activerecord.rbs @@ -406,7 +406,7 @@ module ActiveRecord def in_batches: (?of: Integer, ?start: Integer, ?finish: Integer, ?load: bool, ?error_on_ignore: bool, ?order: untyped) { (self) -> void } -> nil def sum: (?untyped? column_name) -> Integer def destroy_all: () -> untyped - def delete_all: (?Hash[Symbol, untyped] conditions) -> Integer + def delete_all: () -> Integer def update_all: (*untyped) -> untyped def touch_all: (*untyped, ?time: untyped) -> untyped def destroy_by: (*untyped) -> untyped @@ -494,7 +494,7 @@ module ActiveRecord def in_batches: (?of: Integer, ?start: Integer, ?finish: Integer, ?load: bool, ?error_on_ignore: bool, ?order: untyped) { (Relation) -> void } -> nil def sum: (?untyped? column_name) -> Integer def destroy_all: () -> untyped - def delete_all: (?Hash[Symbol, untyped] conditions) -> Integer + def delete_all: () -> Integer def update_all: (*untyped) -> untyped def touch_all: (*untyped, ?time: untyped) -> untyped def destroy_by: (*untyped) -> untyped @@ -576,7 +576,7 @@ interface _ActiveRecord_Relation[Model, PrimaryKey] def in_batches: (?of: Integer, ?start: Integer, ?finish: Integer, ?load: bool, ?error_on_ignore: bool, ?order: untyped) { (self) -> void } -> nil def sum: (?untyped? column_name) -> Integer def destroy_all: () -> untyped - def delete_all: (?Hash[Symbol, untyped] conditions) -> Integer + def delete_all: () -> Integer def update_all: (untyped) -> untyped def touch_all: (*untyped, ?time: untyped) -> untyped def destroy_by: (*untyped) -> untyped @@ -662,7 +662,7 @@ interface _ActiveRecord_Relation_ClassMethods[Model, Relation, PrimaryKey] def in_batches: (?of: Integer, ?start: Integer, ?finish: Integer, ?load: bool, ?error_on_ignore: bool, ?order: untyped) { (Relation) -> void } -> nil def sum: (?untyped? column_name) -> Integer def destroy_all: () -> untyped - def delete_all: (?Hash[Symbol, untyped] conditions) -> Integer + def delete_all: () -> Integer def update_all: (untyped) -> untyped def touch_all: (*untyped, ?time: untyped) -> untyped def destroy_by: (*untyped) -> untyped