Skip to content

Commit 5aeae33

Browse files
authored
Change load_async return type to self (#997)
Update `load_async` to return `self` instead of the explicit `ActiveRecord::Relation[Model]`. While both represent the same runtime object, RBS treats them as distinct types from `Model::ActiveRecord_Relation` (returned by methods like `where` or `all`). This discrepancy causes type mismatches and forces unnecessary type distinctions during method chaining or when defining signatures. Changing it to `self` ensures consistency with other relation methods.
1 parent 2d01126 commit 5aeae33

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

gems/activerecord/7.2/activerecord-7.2.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module ActiveRecord
3232
def insert_all!: (untyped attributes, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
3333
def upsert: (untyped attributes, ?unique_by: untyped?, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
3434
def upsert_all: (untyped attributes, ?unique_by: untyped?, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
35-
def load_async: () -> Relation
35+
def load_async: () -> self
3636
end
3737

3838
module Inheritance

gems/activerecord/8.0/activerecord-8.0.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module ActiveRecord
3232
def insert_all!: (untyped attributes, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
3333
def upsert: (untyped attributes, ?unique_by: untyped?, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
3434
def upsert_all: (untyped attributes, ?unique_by: untyped?, ?returning: untyped?, ?record_timestamps: bool?) -> untyped
35-
def load_async: () -> Relation
35+
def load_async: () -> self
3636
end
3737

3838
module Inheritance

0 commit comments

Comments
 (0)