From f1b4f000139e4fc2856821950f71281f3fe7437e Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 30 Oct 2024 11:12:06 +0900 Subject: [PATCH] activerecord: Allow to use array of Hashes to #preload (#700) --- .../6.0/_test/activerecord-generated.rb | 2 +- gems/activerecord/6.0/activerecord.rbs | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gems/activerecord/6.0/_test/activerecord-generated.rb b/gems/activerecord/6.0/_test/activerecord-generated.rb index 48bb5dc9..df7eaa0e 100644 --- a/gems/activerecord/6.0/_test/activerecord-generated.rb +++ b/gems/activerecord/6.0/_test/activerecord-generated.rb @@ -27,7 +27,7 @@ class Article < ActiveRecord::Base User.eager_load(:address, friends: [:address, :followers]) User.includes(:address, :friends).to_a -User.preload(:address, friends: [:address, :followers]) +User.preload(:address, friends: [:address, { followers: :users }]) # steep:ignore FallbackAny User.in_order_of(:id, [1, 5, 3]) User.offset(5).limit(10) diff --git a/gems/activerecord/6.0/activerecord.rbs b/gems/activerecord/6.0/activerecord.rbs index 0dddb1cb..043ab19e 100644 --- a/gems/activerecord/6.0/activerecord.rbs +++ b/gems/activerecord/6.0/activerecord.rbs @@ -355,9 +355,9 @@ module ActiveRecord def joins: (*String | Symbol | Hash[untyped, untyped]) -> self def left_joins: (*String | Symbol | Hash[untyped, untyped]) -> self def left_outer_joins: (*String | Symbol | Hash[untyped, untyped]) -> self - def includes: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> self - def eager_load: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> self - def preload: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> self + def includes: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> self + def eager_load: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> self + def preload: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> self def find_by: (*untyped) -> Model? def find_by!: (*untyped) -> Model def find: (PrimaryKey id) -> Model @@ -445,9 +445,9 @@ module ActiveRecord def joins: (*String | Symbol | Hash[untyped, untyped]) -> Relation def left_joins: (*String | Symbol | Hash[untyped, untyped]) -> Relation def left_outer_joins: (*String | Symbol | Hash[untyped, untyped]) -> Relation - def includes: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> Relation - def eager_load: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> Relation - def preload: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> Relation + def includes: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> Relation + def eager_load: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> Relation + def preload: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> Relation def find_by: (*untyped) -> Model? def find_by!: (*untyped) -> Model def find: (PrimaryKey id) -> Model @@ -525,9 +525,9 @@ interface _ActiveRecord_Relation[Model, PrimaryKey] def joins: (*String | Symbol | Hash[untyped, untyped]) -> self def left_joins: (*String | Symbol | Hash[untyped, untyped]) -> self def left_outer_joins: (*String | Symbol | Hash[untyped, untyped]) -> self - def includes: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> self - def eager_load: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> self - def preload: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> self + def includes: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> self + def eager_load: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> self + def preload: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> self def find_by: (untyped, *untyped) -> Model? def find_by!: (untyped, *untyped) -> Model def find: (PrimaryKey id) -> Model @@ -613,9 +613,9 @@ interface _ActiveRecord_Relation_ClassMethods[Model, Relation, PrimaryKey] def joins: (*String | Symbol | Hash[untyped, untyped]) -> Relation def left_joins: (*String | Symbol | Hash[untyped, untyped]) -> Relation def left_outer_joins: (*String | Symbol | Hash[untyped, untyped]) -> Relation - def includes: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> Relation - def eager_load: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> Relation - def preload: (*String | Symbol | Array[String | Symbol] | Hash[untyped, untyped], **(String | Symbol | Array[String | Symbol] | Hash[untyped, untyped])) -> Relation + def includes: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> Relation + def eager_load: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> Relation + def preload: (*String | Symbol | Array[untyped] | Hash[untyped, untyped], **(String | Symbol | Array[untyped] | Hash[untyped, untyped])) -> Relation def find_by: (untyped) -> Model? def find_by!: (untyped) -> Model def find: (PrimaryKey id) -> Model