sorbet-rails 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/sorbet-rails/gem_plugins/active_flag_plugin.rb +0 -1
  4. data/lib/sorbet-rails/gem_plugins/paperclip_plugin.rb +0 -1
  5. data/lib/sorbet-rails/model_plugins/active_record_assoc.rb +9 -2
  6. data/lib/sorbet-rails/model_plugins/active_record_attribute.rb +0 -1
  7. data/lib/sorbet-rails/model_plugins/active_record_enum.rb +0 -1
  8. data/lib/sorbet-rails/model_plugins/active_record_named_scope.rb +15 -6
  9. data/lib/sorbet-rails/model_plugins/active_record_querying.rb +5 -1
  10. data/lib/sorbet-rails/model_plugins/base.rb +2 -1
  11. data/lib/sorbet-rails/model_rbi_formatter.rb +4 -8
  12. data/lib/sorbet-rails/model_utils.rb +68 -30
  13. data/lib/sorbet-rails/tasks/rails_rbi.rake +13 -21
  14. data/sorbet-rails.gemspec +1 -1
  15. data/spec/generators/rails-template.rb +3 -6
  16. data/spec/generators/sorbet_test_cases.rb +41 -26
  17. data/spec/support/v5.0/Gemfile.lock +2 -2
  18. data/spec/support/v5.0/app/models/spell_book.rb +2 -0
  19. data/spec/support/v5.0/app/models/wizard.rb +1 -1
  20. data/spec/support/v5.0/sorbet_test_cases.rb +41 -26
  21. data/spec/support/v5.1/Gemfile.lock +2 -2
  22. data/spec/support/v5.1/app/models/spell_book.rb +2 -0
  23. data/spec/support/v5.1/app/models/wizard.rb +1 -1
  24. data/spec/support/v5.1/sorbet_test_cases.rb +41 -26
  25. data/spec/support/v5.2/Gemfile.lock +2 -2
  26. data/spec/support/v5.2/app/models/spell_book.rb +2 -0
  27. data/spec/support/v5.2/app/models/wizard.rb +1 -1
  28. data/spec/support/v5.2/sorbet_test_cases.rb +41 -26
  29. data/spec/support/v6.0/Gemfile.lock +2 -2
  30. data/spec/support/v6.0/app/models/spell_book.rb +2 -0
  31. data/spec/support/v6.0/app/models/wizard.rb +1 -1
  32. data/spec/support/v6.0/sorbet_test_cases.rb +41 -26
  33. data/spec/test_data/v5.0/expected_headmaster.rbi +18 -190
  34. data/spec/test_data/v5.0/expected_internal_metadata.rbi +18 -188
  35. data/spec/test_data/v5.0/expected_potion.rbi +18 -188
  36. data/spec/test_data/v5.0/expected_robe.rbi +18 -190
  37. data/spec/test_data/v5.0/expected_schema_migration.rbi +18 -188
  38. data/spec/test_data/v5.0/expected_school.rbi +18 -190
  39. data/spec/test_data/v5.0/expected_spell.rbi +18 -190
  40. data/spec/test_data/v5.0/expected_spell/habtm_spell_books.rbi +18 -190
  41. data/spec/test_data/v5.0/expected_spell_book.rbi +55 -217
  42. data/spec/test_data/v5.0/expected_spell_book/habtm_spells.rbi +18 -190
  43. data/spec/test_data/v5.0/expected_squib.rbi +90 -264
  44. data/spec/test_data/v5.0/expected_subject.rbi +18 -190
  45. data/spec/test_data/v5.0/expected_subject/habtm_wizards.rbi +18 -190
  46. data/spec/test_data/v5.0/expected_wand.rbi +53 -227
  47. data/spec/test_data/v5.0/expected_wizard.rbi +90 -264
  48. data/spec/test_data/v5.0/expected_wizard/habtm_subjects.rbi +18 -190
  49. data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +90 -264
  50. data/spec/test_data/v5.1/expected_headmaster.rbi +18 -196
  51. data/spec/test_data/v5.1/expected_internal_metadata.rbi +18 -194
  52. data/spec/test_data/v5.1/expected_potion.rbi +18 -194
  53. data/spec/test_data/v5.1/expected_robe.rbi +18 -196
  54. data/spec/test_data/v5.1/expected_schema_migration.rbi +18 -194
  55. data/spec/test_data/v5.1/expected_school.rbi +18 -196
  56. data/spec/test_data/v5.1/expected_spell.rbi +18 -196
  57. data/spec/test_data/v5.1/expected_spell/habtm_spell_books.rbi +18 -196
  58. data/spec/test_data/v5.1/expected_spell_book.rbi +55 -223
  59. data/spec/test_data/v5.1/expected_spell_book/habtm_spells.rbi +18 -196
  60. data/spec/test_data/v5.1/expected_squib.rbi +91 -271
  61. data/spec/test_data/v5.1/expected_subject.rbi +18 -196
  62. data/spec/test_data/v5.1/expected_subject/habtm_wizards.rbi +18 -196
  63. data/spec/test_data/v5.1/expected_wand.rbi +53 -233
  64. data/spec/test_data/v5.1/expected_wizard.rbi +91 -271
  65. data/spec/test_data/v5.1/expected_wizard/habtm_subjects.rbi +18 -196
  66. data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +91 -271
  67. data/spec/test_data/v5.2/expected_attachment.rbi +18 -194
  68. data/spec/test_data/v5.2/expected_blob.rbi +39 -215
  69. data/spec/test_data/v5.2/expected_headmaster.rbi +18 -196
  70. data/spec/test_data/v5.2/expected_internal_metadata.rbi +18 -194
  71. data/spec/test_data/v5.2/expected_potion.rbi +18 -194
  72. data/spec/test_data/v5.2/expected_robe.rbi +18 -196
  73. data/spec/test_data/v5.2/expected_schema_migration.rbi +18 -194
  74. data/spec/test_data/v5.2/expected_school.rbi +18 -196
  75. data/spec/test_data/v5.2/expected_spell.rbi +18 -196
  76. data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +18 -196
  77. data/spec/test_data/v5.2/expected_spell_book.rbi +55 -223
  78. data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +18 -196
  79. data/spec/test_data/v5.2/expected_squib.rbi +95 -275
  80. data/spec/test_data/v5.2/expected_subject.rbi +18 -196
  81. data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +18 -196
  82. data/spec/test_data/v5.2/expected_wand.rbi +53 -233
  83. data/spec/test_data/v5.2/expected_wizard.rbi +95 -275
  84. data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +18 -196
  85. data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +95 -275
  86. data/spec/test_data/v6.0/expected_attachment.rbi +18 -218
  87. data/spec/test_data/v6.0/expected_blob.rbi +31 -243
  88. data/spec/test_data/v6.0/expected_headmaster.rbi +18 -220
  89. data/spec/test_data/v6.0/expected_internal_metadata.rbi +18 -218
  90. data/spec/test_data/v6.0/expected_potion.rbi +18 -218
  91. data/spec/test_data/v6.0/expected_robe.rbi +18 -220
  92. data/spec/test_data/v6.0/expected_schema_migration.rbi +18 -218
  93. data/spec/test_data/v6.0/expected_school.rbi +18 -220
  94. data/spec/test_data/v6.0/expected_spell.rbi +18 -220
  95. data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +18 -220
  96. data/spec/test_data/v6.0/expected_spell_book.rbi +24 -258
  97. data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +18 -220
  98. data/spec/test_data/v6.0/expected_squib.rbi +31 -457
  99. data/spec/test_data/v6.0/expected_subject.rbi +18 -220
  100. data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +18 -220
  101. data/spec/test_data/v6.0/expected_wand.rbi +18 -270
  102. data/spec/test_data/v6.0/expected_wizard.rbi +31 -457
  103. data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +18 -220
  104. data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +31 -457
  105. metadata +1 -1
@@ -2,7 +2,7 @@
2
2
  class Wizard < ApplicationRecord
3
3
  validates :name, length: { minimum: 5 }, presence: true
4
4
  # simulate conditional validation
5
- validates :parent_email, presence: true, if: -> { false }
5
+ validates :parent_email, presence: true, if: :Slytherin?
6
6
 
7
7
  typed_enum house: {
8
8
  Gryffindor: 0,
@@ -29,26 +29,6 @@ T.assert_type!(T.must(wizard.wand).wizard, Wizard)
29
29
  T.assert_type!(wizard.spell_books, SpellBook::ActiveRecord_Associations_CollectionProxy)
30
30
  T.assert_type!(wizard.spell_book_ids, T::Array[Integer])
31
31
 
32
- # -- model relation
33
- # default
34
- T.assert_type!(Wizard.all, Wizard::ActiveRecord_Relation)
35
-
36
- # custom scope
37
- T.assert_type!(Wizard.recent, Wizard::ActiveRecord_Relation)
38
-
39
- # enum scope
40
- T.assert_type!(Wizard.Gryffindor, Wizard::ActiveRecord_Relation)
41
-
42
- # ActiveRecord Querying
43
- T.assert_type!(Wizard.Gryffindor.recent, Wizard::ActiveRecord_Relation)
44
- T.assert_type!(Wizard.Gryffindor.recent.unscoped, Wizard::ActiveRecord_Relation)
45
- T.assert_type!(Wizard.where(id: 1), Wizard::ActiveRecord_Relation)
46
- T.assert_type!(Wizard.where(id: 1).recent, Wizard::ActiveRecord_Relation)
47
- T.assert_type!(Wizard.where.not(id: 1), Wizard::ActiveRecord_Relation)
48
- T.assert_type!(Wizard.preload(:spell_books), Wizard::ActiveRecord_Relation)
49
- T.assert_type!(Wizard.eager_load(:spell_books), Wizard::ActiveRecord_Relation)
50
- T.assert_type!(Wizard.order(:id), Wizard::ActiveRecord_Relation)
51
-
52
32
  # Finder methods -- Model
53
33
  T.assert_type!(Wizard.exists?(name: 'Test'), T::Boolean)
54
34
  T.assert_type!(Wizard.find(wizard.id), Wizard)
@@ -90,6 +70,18 @@ T.assert_type!(Wizard.none?, T::Boolean)
90
70
  T.assert_type!(Wizard.one?, T::Boolean)
91
71
  # T.assert_type!(Wizard.update_all(name: 'Harry Potter'), Integer) # Ignored until we add support
92
72
  # T.assert_type!(Wizard.delete_all, Integer) # Ignored until we add support
73
+ # Query methods
74
+ T.assert_type!(Wizard.all, Wizard::ActiveRecord_Relation)
75
+ T.assert_type!(Wizard.recent, Wizard::ActiveRecord_Relation) # Named scope
76
+ T.assert_type!(Wizard.Gryffindor, Wizard::ActiveRecord_Relation) # Enum scope
77
+ T.assert_type!(Wizard.Gryffindor.recent, Wizard::ActiveRecord_Relation)
78
+ T.assert_type!(Wizard.Gryffindor.recent.unscoped, Wizard::ActiveRecord_Relation)
79
+ T.assert_type!(Wizard.where(id: 1), Wizard::ActiveRecord_Relation)
80
+ T.assert_type!(Wizard.where(id: 1).recent, Wizard::ActiveRecord_Relation)
81
+ T.assert_type!(Wizard.where.not(id: 1), Wizard::ActiveRecord_Relation)
82
+ T.assert_type!(Wizard.preload(:spell_books), Wizard::ActiveRecord_Relation)
83
+ T.assert_type!(Wizard.eager_load(:spell_books), Wizard::ActiveRecord_Relation)
84
+ T.assert_type!(Wizard.order(:id), Wizard::ActiveRecord_Relation)
93
85
 
94
86
  # Finder methods -- ActiveRecord::Relation
95
87
  T.assert_type!(Wizard.all.exists?(name: 'Harry Potter'), T::Boolean)
@@ -133,6 +125,18 @@ T.assert_type!(Wizard.all.none?, T::Boolean)
133
125
  T.assert_type!(Wizard.all.one?, T::Boolean)
134
126
  # T.assert_type!(Wizard.all.update_all(name: 'Harry Potter'), Integer) # Ignored until we add support
135
127
  # T.assert_type!(Wizard.all.delete_all, Integer) # Ignored until we add support
128
+ # Query methods
129
+ T.assert_type!(Wizard.all.all, Wizard::ActiveRecord_Relation)
130
+ T.assert_type!(Wizard.all.recent, Wizard::ActiveRecord_Relation) # Named scope
131
+ T.assert_type!(Wizard.all.Gryffindor, Wizard::ActiveRecord_Relation) # Enum scope
132
+ T.assert_type!(Wizard.all.Gryffindor.recent, Wizard::ActiveRecord_Relation)
133
+ T.assert_type!(Wizard.all.Gryffindor.recent.unscoped, Wizard::ActiveRecord_Relation)
134
+ T.assert_type!(Wizard.all.where(id: 1), Wizard::ActiveRecord_Relation)
135
+ T.assert_type!(Wizard.all.where(id: 1).recent, Wizard::ActiveRecord_Relation)
136
+ T.assert_type!(Wizard.all.where.not(id: 1), Wizard::ActiveRecord_Relation)
137
+ T.assert_type!(Wizard.all.preload(:spell_books), Wizard::ActiveRecord_Relation)
138
+ T.assert_type!(Wizard.all.eager_load(:spell_books), Wizard::ActiveRecord_Relation)
139
+ T.assert_type!(Wizard.all.order(:id), Wizard::ActiveRecord_Relation)
136
140
  # Enumerable methods
137
141
  Wizard.all.each { |w| T.assert_type!(w, Wizard) }
138
142
  Wizard.all.map { |w| T.assert_type!(w, Wizard) }
@@ -183,13 +187,18 @@ T.assert_type!(spell_books.none?, T::Boolean)
183
187
  T.assert_type!(spell_books.one?, T::Boolean)
184
188
  # T.assert_type!(spell_books.update_all(name: 'Fantastic Beasts'), Integer) # Ignored until we add support
185
189
  # T.assert_type!(spell_books.delete_all, Integer) # Ignored until we add support
186
- # CollectionProxy query also typed correctly!
190
+ # Query methods
191
+ T.assert_type!(spell_books.all, SpellBook::ActiveRecord_AssociationRelation)
192
+ T.assert_type!(spell_books.recent, SpellBook::ActiveRecord_AssociationRelation) # Named scope
193
+ T.assert_type!(spell_books.unclassified, SpellBook::ActiveRecord_AssociationRelation) # Enum scope
194
+ T.assert_type!(spell_books.unclassified.recent, SpellBook::ActiveRecord_AssociationRelation)
195
+ T.assert_type!(spell_books.unclassified.recent.unscoped, SpellBook::ActiveRecord_Relation) # Turns back into relation
187
196
  T.assert_type!(spell_books.where(id: 1), SpellBook::ActiveRecord_AssociationRelation)
197
+ T.assert_type!(spell_books.where(id: 1).recent, SpellBook::ActiveRecord_AssociationRelation)
198
+ T.assert_type!(spell_books.where.not(id: 1), SpellBook::ActiveRecord_AssociationRelation)
188
199
  T.assert_type!(spell_books.preload(:wizard), SpellBook::ActiveRecord_AssociationRelation)
189
200
  T.assert_type!(spell_books.eager_load(:wizard), SpellBook::ActiveRecord_AssociationRelation)
190
201
  T.assert_type!(spell_books.order(:id), SpellBook::ActiveRecord_AssociationRelation)
191
- T.assert_type!(spell_books.where.not(id: 1), SpellBook::ActiveRecord_AssociationRelation)
192
- T.assert_type!(spell_books.biology, SpellBook::ActiveRecord_AssociationRelation)
193
202
  # Enumerable methods
194
203
  spell_books.each { |s| T.assert_type!(s, SpellBook) }
195
204
  spell_books.map { |s| T.assert_type!(s, SpellBook) }
@@ -248,12 +257,18 @@ T.assert_type!(spell_books_query.none?, T::Boolean)
248
257
  T.assert_type!(spell_books_query.one?, T::Boolean)
249
258
  # T.assert_type!(spell_books_query.update_all(name: 'Fantastic Beasts'), Integer) # Ignored until we add support
250
259
  # T.assert_type!(spell_books_query.delete_all, Integer) # Ignored until we add support
251
- # Query chaining
260
+ # Query methods
261
+ T.assert_type!(spell_books_query.all, SpellBook::ActiveRecord_AssociationRelation)
262
+ T.assert_type!(spell_books_query.recent, SpellBook::ActiveRecord_AssociationRelation) # Named scope
263
+ T.assert_type!(spell_books_query.unclassified, SpellBook::ActiveRecord_AssociationRelation) # Enum scope
264
+ T.assert_type!(spell_books_query.unclassified.recent, SpellBook::ActiveRecord_AssociationRelation)
265
+ T.assert_type!(spell_books_query.unclassified.recent.unscoped, SpellBook::ActiveRecord_Relation) # Turns back into relation
266
+ T.assert_type!(spell_books_query.where(id: 1), SpellBook::ActiveRecord_AssociationRelation)
267
+ T.assert_type!(spell_books_query.where(id: 1).recent, SpellBook::ActiveRecord_AssociationRelation)
268
+ T.assert_type!(spell_books_query.where.not(id: 1), SpellBook::ActiveRecord_AssociationRelation)
252
269
  T.assert_type!(spell_books_query.preload(:wizard), SpellBook::ActiveRecord_AssociationRelation)
253
270
  T.assert_type!(spell_books_query.eager_load(:wizard), SpellBook::ActiveRecord_AssociationRelation)
254
271
  T.assert_type!(spell_books_query.order(:id), SpellBook::ActiveRecord_AssociationRelation)
255
- T.assert_type!(spell_books_query.where.not(id: 1), SpellBook::ActiveRecord_AssociationRelation)
256
- T.assert_type!(spell_books_query.biology, SpellBook::ActiveRecord_AssociationRelation)
257
272
  # Enumerable methods
258
273
  spell_books_query.each { |s| T.assert_type!(s, SpellBook) }
259
274
  spell_books_query.map { |s| T.assert_type!(s, SpellBook) }
@@ -8,8 +8,6 @@ module Headmaster::ActiveRelation_WhereNot
8
8
  end
9
9
 
10
10
  module Headmaster::GeneratedAttributeMethods
11
- extend T::Sig
12
-
13
11
  sig { returns(Integer) }
14
12
  def id; end
15
13
 
@@ -39,8 +37,6 @@ module Headmaster::GeneratedAttributeMethods
39
37
  end
40
38
 
41
39
  module Headmaster::GeneratedAssociationMethods
42
- extend T::Sig
43
-
44
40
  sig { returns(::School) }
45
41
  def school; end
46
42
 
@@ -75,102 +71,11 @@ class Headmaster < ApplicationRecord
75
71
  include Headmaster::GeneratedAttributeMethods
76
72
  include Headmaster::GeneratedAssociationMethods
77
73
  extend Headmaster::CustomFinderMethods
78
- extend T::Sig
79
- extend T::Generic
74
+ extend Headmaster::QueryMethodsReturningRelation
80
75
  RelationType = T.type_alias { T.any(Headmaster::ActiveRecord_Relation, Headmaster::ActiveRecord_Associations_CollectionProxy, Headmaster::ActiveRecord_AssociationRelation) }
81
-
82
- sig { returns(Headmaster::ActiveRecord_Relation) }
83
- def self.all; end
84
-
85
- sig { params(block: T.nilable(T.proc.void)).returns(Headmaster::ActiveRecord_Relation) }
86
- def self.unscoped(&block); end
87
-
88
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
89
- def self.select(*args); end
90
-
91
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
92
- def self.order(*args); end
93
-
94
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
95
- def self.reorder(*args); end
96
-
97
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
98
- def self.group(*args); end
99
-
100
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
101
- def self.limit(*args); end
102
-
103
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
104
- def self.offset(*args); end
105
-
106
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
107
- def self.joins(*args); end
108
-
109
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
110
- def self.left_joins(*args); end
111
-
112
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
113
- def self.left_outer_joins(*args); end
114
-
115
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
116
- def self.where(*args); end
117
-
118
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
119
- def self.rewhere(*args); end
120
-
121
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
122
- def self.preload(*args); end
123
-
124
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
125
- def self.eager_load(*args); end
126
-
127
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
128
- def self.includes(*args); end
129
-
130
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
131
- def self.from(*args); end
132
-
133
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
134
- def self.lock(*args); end
135
-
136
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
137
- def self.readonly(*args); end
138
-
139
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
140
- def self.or(*args); end
141
-
142
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
143
- def self.having(*args); end
144
-
145
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
146
- def self.create_with(*args); end
147
-
148
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
149
- def self.distinct(*args); end
150
-
151
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
152
- def self.references(*args); end
153
-
154
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
155
- def self.none(*args); end
156
-
157
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
158
- def self.unscope(*args); end
159
-
160
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_Relation) }
161
- def self.except(*args); end
162
-
163
- sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(Headmaster::ActiveRecord_Relation) }
164
- def self.extending(*args, &block); end
165
76
  end
166
77
 
167
- class Headmaster::ActiveRecord_Relation < ActiveRecord::Relation
168
- include Headmaster::ActiveRelation_WhereNot
169
- include Headmaster::CustomFinderMethods
170
- extend T::Sig
171
- extend T::Generic
172
- Elem = type_member(fixed: Headmaster)
173
-
78
+ module Headmaster::QueryMethodsReturningRelation
174
79
  sig { returns(Headmaster::ActiveRecord_Relation) }
175
80
  def all; end
176
81
 
@@ -256,17 +161,11 @@ class Headmaster::ActiveRecord_Relation < ActiveRecord::Relation
256
161
  def extending(*args, &block); end
257
162
  end
258
163
 
259
- class Headmaster::ActiveRecord_AssociationRelation < ActiveRecord::AssociationRelation
260
- include Headmaster::ActiveRelation_WhereNot
261
- include Headmaster::CustomFinderMethods
262
- extend T::Sig
263
- extend T::Generic
264
- Elem = type_member(fixed: Headmaster)
265
-
164
+ module Headmaster::QueryMethodsReturningAssociationRelation
266
165
  sig { returns(Headmaster::ActiveRecord_AssociationRelation) }
267
166
  def all; end
268
167
 
269
- sig { params(block: T.nilable(T.proc.void)).returns(Headmaster::ActiveRecord_AssociationRelation) }
168
+ sig { params(block: T.nilable(T.proc.void)).returns(Headmaster::ActiveRecord_Relation) }
270
169
  def unscoped(&block); end
271
170
 
272
171
  sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
@@ -348,95 +247,24 @@ class Headmaster::ActiveRecord_AssociationRelation < ActiveRecord::AssociationRe
348
247
  def extending(*args, &block); end
349
248
  end
350
249
 
351
- class Headmaster::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
250
+ class Headmaster::ActiveRecord_Relation < ActiveRecord::Relation
251
+ include Headmaster::ActiveRelation_WhereNot
352
252
  include Headmaster::CustomFinderMethods
353
- extend T::Sig
354
- extend T::Generic
253
+ include Headmaster::QueryMethodsReturningRelation
355
254
  Elem = type_member(fixed: Headmaster)
255
+ end
356
256
 
357
- sig { returns(Headmaster::ActiveRecord_AssociationRelation) }
358
- def all; end
359
-
360
- sig { params(block: T.nilable(T.proc.void)).returns(Headmaster::ActiveRecord_AssociationRelation) }
361
- def unscoped(&block); end
362
-
363
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
364
- def select(*args); end
365
-
366
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
367
- def order(*args); end
368
-
369
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
370
- def reorder(*args); end
371
-
372
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
373
- def group(*args); end
374
-
375
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
376
- def limit(*args); end
377
-
378
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
379
- def offset(*args); end
380
-
381
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
382
- def joins(*args); end
383
-
384
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
385
- def left_joins(*args); end
386
-
387
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
388
- def left_outer_joins(*args); end
389
-
390
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
391
- def where(*args); end
392
-
393
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
394
- def rewhere(*args); end
395
-
396
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
397
- def preload(*args); end
398
-
399
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
400
- def eager_load(*args); end
401
-
402
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
403
- def includes(*args); end
404
-
405
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
406
- def from(*args); end
407
-
408
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
409
- def lock(*args); end
410
-
411
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
412
- def readonly(*args); end
413
-
414
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
415
- def or(*args); end
416
-
417
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
418
- def having(*args); end
419
-
420
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
421
- def create_with(*args); end
422
-
423
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
424
- def distinct(*args); end
425
-
426
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
427
- def references(*args); end
428
-
429
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
430
- def none(*args); end
431
-
432
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
433
- def unscope(*args); end
434
-
435
- sig { params(args: T.untyped).returns(Headmaster::ActiveRecord_AssociationRelation) }
436
- def except(*args); end
257
+ class Headmaster::ActiveRecord_AssociationRelation < ActiveRecord::AssociationRelation
258
+ include Headmaster::ActiveRelation_WhereNot
259
+ include Headmaster::CustomFinderMethods
260
+ include Headmaster::QueryMethodsReturningAssociationRelation
261
+ Elem = type_member(fixed: Headmaster)
262
+ end
437
263
 
438
- sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(Headmaster::ActiveRecord_AssociationRelation) }
439
- def extending(*args, &block); end
264
+ class Headmaster::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
265
+ include Headmaster::CustomFinderMethods
266
+ include Headmaster::QueryMethodsReturningAssociationRelation
267
+ Elem = type_member(fixed: Headmaster)
440
268
 
441
269
  sig { params(records: T.any(Headmaster, T::Array[Headmaster])).returns(T.self_type) }
442
270
  def <<(*records); end
@@ -8,8 +8,6 @@ module ActiveRecord::InternalMetadata::ActiveRelation_WhereNot
8
8
  end
9
9
 
10
10
  module ActiveRecord::InternalMetadata::GeneratedAttributeMethods
11
- extend T::Sig
12
-
13
11
  sig { returns(ActiveSupport::TimeWithZone) }
14
12
  def created_at; end
15
13
 
@@ -67,102 +65,11 @@ end
67
65
  class ActiveRecord::InternalMetadata < ActiveRecord::Base
68
66
  include ActiveRecord::InternalMetadata::GeneratedAttributeMethods
69
67
  extend ActiveRecord::InternalMetadata::CustomFinderMethods
70
- extend T::Sig
71
- extend T::Generic
68
+ extend ActiveRecord::InternalMetadata::QueryMethodsReturningRelation
72
69
  RelationType = T.type_alias { T.any(ActiveRecord::InternalMetadata::ActiveRecord_Relation, ActiveRecord::InternalMetadata::ActiveRecord_Associations_CollectionProxy, ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
73
-
74
- sig { returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
75
- def self.all; end
76
-
77
- sig { params(block: T.nilable(T.proc.void)).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
78
- def self.unscoped(&block); end
79
-
80
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
81
- def self.select(*args); end
82
-
83
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
84
- def self.order(*args); end
85
-
86
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
87
- def self.reorder(*args); end
88
-
89
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
90
- def self.group(*args); end
91
-
92
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
93
- def self.limit(*args); end
94
-
95
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
96
- def self.offset(*args); end
97
-
98
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
99
- def self.joins(*args); end
100
-
101
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
102
- def self.left_joins(*args); end
103
-
104
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
105
- def self.left_outer_joins(*args); end
106
-
107
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
108
- def self.where(*args); end
109
-
110
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
111
- def self.rewhere(*args); end
112
-
113
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
114
- def self.preload(*args); end
115
-
116
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
117
- def self.eager_load(*args); end
118
-
119
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
120
- def self.includes(*args); end
121
-
122
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
123
- def self.from(*args); end
124
-
125
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
126
- def self.lock(*args); end
127
-
128
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
129
- def self.readonly(*args); end
130
-
131
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
132
- def self.or(*args); end
133
-
134
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
135
- def self.having(*args); end
136
-
137
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
138
- def self.create_with(*args); end
139
-
140
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
141
- def self.distinct(*args); end
142
-
143
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
144
- def self.references(*args); end
145
-
146
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
147
- def self.none(*args); end
148
-
149
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
150
- def self.unscope(*args); end
151
-
152
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
153
- def self.except(*args); end
154
-
155
- sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
156
- def self.extending(*args, &block); end
157
70
  end
158
71
 
159
- class ActiveRecord::InternalMetadata::ActiveRecord_Relation < ActiveRecord::Relation
160
- include ActiveRecord::InternalMetadata::ActiveRelation_WhereNot
161
- include ActiveRecord::InternalMetadata::CustomFinderMethods
162
- extend T::Sig
163
- extend T::Generic
164
- Elem = type_member(fixed: ActiveRecord::InternalMetadata)
165
-
72
+ module ActiveRecord::InternalMetadata::QueryMethodsReturningRelation
166
73
  sig { returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
167
74
  def all; end
168
75
 
@@ -248,17 +155,11 @@ class ActiveRecord::InternalMetadata::ActiveRecord_Relation < ActiveRecord::Rela
248
155
  def extending(*args, &block); end
249
156
  end
250
157
 
251
- class ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation < ActiveRecord::AssociationRelation
252
- include ActiveRecord::InternalMetadata::ActiveRelation_WhereNot
253
- include ActiveRecord::InternalMetadata::CustomFinderMethods
254
- extend T::Sig
255
- extend T::Generic
256
- Elem = type_member(fixed: ActiveRecord::InternalMetadata)
257
-
158
+ module ActiveRecord::InternalMetadata::QueryMethodsReturningAssociationRelation
258
159
  sig { returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
259
160
  def all; end
260
161
 
261
- sig { params(block: T.nilable(T.proc.void)).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
162
+ sig { params(block: T.nilable(T.proc.void)).returns(ActiveRecord::InternalMetadata::ActiveRecord_Relation) }
262
163
  def unscoped(&block); end
263
164
 
264
165
  sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
@@ -340,95 +241,24 @@ class ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation < ActiveR
340
241
  def extending(*args, &block); end
341
242
  end
342
243
 
343
- class ActiveRecord::InternalMetadata::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
244
+ class ActiveRecord::InternalMetadata::ActiveRecord_Relation < ActiveRecord::Relation
245
+ include ActiveRecord::InternalMetadata::ActiveRelation_WhereNot
344
246
  include ActiveRecord::InternalMetadata::CustomFinderMethods
345
- extend T::Sig
346
- extend T::Generic
247
+ include ActiveRecord::InternalMetadata::QueryMethodsReturningRelation
347
248
  Elem = type_member(fixed: ActiveRecord::InternalMetadata)
249
+ end
348
250
 
349
- sig { returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
350
- def all; end
351
-
352
- sig { params(block: T.nilable(T.proc.void)).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
353
- def unscoped(&block); end
354
-
355
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
356
- def select(*args); end
357
-
358
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
359
- def order(*args); end
360
-
361
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
362
- def reorder(*args); end
363
-
364
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
365
- def group(*args); end
366
-
367
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
368
- def limit(*args); end
369
-
370
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
371
- def offset(*args); end
372
-
373
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
374
- def joins(*args); end
375
-
376
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
377
- def left_joins(*args); end
378
-
379
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
380
- def left_outer_joins(*args); end
381
-
382
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
383
- def where(*args); end
384
-
385
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
386
- def rewhere(*args); end
387
-
388
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
389
- def preload(*args); end
390
-
391
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
392
- def eager_load(*args); end
393
-
394
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
395
- def includes(*args); end
396
-
397
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
398
- def from(*args); end
399
-
400
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
401
- def lock(*args); end
402
-
403
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
404
- def readonly(*args); end
405
-
406
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
407
- def or(*args); end
408
-
409
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
410
- def having(*args); end
411
-
412
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
413
- def create_with(*args); end
414
-
415
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
416
- def distinct(*args); end
417
-
418
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
419
- def references(*args); end
420
-
421
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
422
- def none(*args); end
423
-
424
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
425
- def unscope(*args); end
426
-
427
- sig { params(args: T.untyped).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
428
- def except(*args); end
251
+ class ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation < ActiveRecord::AssociationRelation
252
+ include ActiveRecord::InternalMetadata::ActiveRelation_WhereNot
253
+ include ActiveRecord::InternalMetadata::CustomFinderMethods
254
+ include ActiveRecord::InternalMetadata::QueryMethodsReturningAssociationRelation
255
+ Elem = type_member(fixed: ActiveRecord::InternalMetadata)
256
+ end
429
257
 
430
- sig { params(args: T.untyped, block: T.nilable(T.proc.void)).returns(ActiveRecord::InternalMetadata::ActiveRecord_AssociationRelation) }
431
- def extending(*args, &block); end
258
+ class ActiveRecord::InternalMetadata::ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::CollectionProxy
259
+ include ActiveRecord::InternalMetadata::CustomFinderMethods
260
+ include ActiveRecord::InternalMetadata::QueryMethodsReturningAssociationRelation
261
+ Elem = type_member(fixed: ActiveRecord::InternalMetadata)
432
262
 
433
263
  sig { params(records: T.any(ActiveRecord::InternalMetadata, T::Array[ActiveRecord::InternalMetadata])).returns(T.self_type) }
434
264
  def <<(*records); end