activerecord 7.2.4 → 8.0.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +192 -1305
  3. data/README.rdoc +2 -2
  4. data/lib/active_record/associations/alias_tracker.rb +4 -6
  5. data/lib/active_record/associations/association.rb +25 -5
  6. data/lib/active_record/associations/belongs_to_association.rb +2 -18
  7. data/lib/active_record/associations/builder/association.rb +7 -6
  8. data/lib/active_record/associations/collection_association.rb +4 -4
  9. data/lib/active_record/associations/disable_joins_association_scope.rb +1 -1
  10. data/lib/active_record/associations/has_many_through_association.rb +4 -9
  11. data/lib/active_record/associations/join_dependency/join_association.rb +27 -25
  12. data/lib/active_record/associations/join_dependency.rb +2 -2
  13. data/lib/active_record/associations/preloader/association.rb +2 -2
  14. data/lib/active_record/associations/singular_association.rb +8 -3
  15. data/lib/active_record/associations.rb +50 -32
  16. data/lib/active_record/asynchronous_queries_tracker.rb +28 -24
  17. data/lib/active_record/attribute_methods/serialization.rb +1 -1
  18. data/lib/active_record/attribute_methods.rb +18 -25
  19. data/lib/active_record/attributes.rb +26 -37
  20. data/lib/active_record/autosave_association.rb +81 -49
  21. data/lib/active_record/base.rb +2 -2
  22. data/lib/active_record/callbacks.rb +1 -1
  23. data/lib/active_record/connection_adapters/abstract/connection_handler.rb +16 -10
  24. data/lib/active_record/connection_adapters/abstract/connection_pool/queue.rb +0 -1
  25. data/lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb +0 -1
  26. data/lib/active_record/connection_adapters/abstract/connection_pool.rb +31 -75
  27. data/lib/active_record/connection_adapters/abstract/database_statements.rb +91 -44
  28. data/lib/active_record/connection_adapters/abstract/query_cache.rb +14 -19
  29. data/lib/active_record/connection_adapters/abstract/quoting.rb +1 -1
  30. data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +2 -6
  31. data/lib/active_record/connection_adapters/abstract/schema_statements.rb +27 -9
  32. data/lib/active_record/connection_adapters/abstract/transaction.rb +15 -5
  33. data/lib/active_record/connection_adapters/abstract_adapter.rb +51 -86
  34. data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +28 -58
  35. data/lib/active_record/connection_adapters/mysql/quoting.rb +1 -15
  36. data/lib/active_record/connection_adapters/mysql/schema_definitions.rb +2 -8
  37. data/lib/active_record/connection_adapters/mysql/schema_statements.rb +43 -45
  38. data/lib/active_record/connection_adapters/mysql2/database_statements.rb +42 -98
  39. data/lib/active_record/connection_adapters/mysql2_adapter.rb +2 -16
  40. data/lib/active_record/connection_adapters/postgresql/database_statements.rb +64 -42
  41. data/lib/active_record/connection_adapters/postgresql/oid/point.rb +10 -0
  42. data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +0 -1
  43. data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +12 -14
  44. data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +1 -1
  45. data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +51 -9
  46. data/lib/active_record/connection_adapters/postgresql_adapter.rb +44 -101
  47. data/lib/active_record/connection_adapters/schema_cache.rb +1 -3
  48. data/lib/active_record/connection_adapters/sqlite3/database_statements.rb +76 -100
  49. data/lib/active_record/connection_adapters/sqlite3/quoting.rb +0 -13
  50. data/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +0 -6
  51. data/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb +13 -0
  52. data/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +8 -2
  53. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +60 -22
  54. data/lib/active_record/connection_adapters/trilogy/database_statements.rb +37 -67
  55. data/lib/active_record/connection_adapters/trilogy_adapter.rb +1 -18
  56. data/lib/active_record/connection_handling.rb +29 -11
  57. data/lib/active_record/core.rb +15 -60
  58. data/lib/active_record/counter_cache.rb +1 -1
  59. data/lib/active_record/database_configurations/connection_url_resolver.rb +1 -3
  60. data/lib/active_record/delegated_type.rb +18 -18
  61. data/lib/active_record/encryption/config.rb +3 -1
  62. data/lib/active_record/encryption/encryptable_record.rb +5 -5
  63. data/lib/active_record/encryption/encrypted_attribute_type.rb +11 -2
  64. data/lib/active_record/encryption/encryptor.rb +35 -29
  65. data/lib/active_record/encryption/extended_deterministic_queries.rb +4 -2
  66. data/lib/active_record/encryption/scheme.rb +8 -1
  67. data/lib/active_record/enum.rb +12 -13
  68. data/lib/active_record/errors.rb +16 -8
  69. data/lib/active_record/fixture_set/table_row.rb +2 -19
  70. data/lib/active_record/fixtures.rb +0 -1
  71. data/lib/active_record/future_result.rb +14 -10
  72. data/lib/active_record/gem_version.rb +4 -4
  73. data/lib/active_record/insert_all.rb +1 -1
  74. data/lib/active_record/marshalling.rb +1 -4
  75. data/lib/active_record/migration/command_recorder.rb +22 -5
  76. data/lib/active_record/migration/compatibility.rb +5 -2
  77. data/lib/active_record/migration.rb +36 -35
  78. data/lib/active_record/model_schema.rb +1 -1
  79. data/lib/active_record/nested_attributes.rb +4 -6
  80. data/lib/active_record/persistence.rb +128 -130
  81. data/lib/active_record/query_cache.rb +5 -4
  82. data/lib/active_record/query_logs.rb +98 -44
  83. data/lib/active_record/query_logs_formatter.rb +17 -28
  84. data/lib/active_record/querying.rb +10 -10
  85. data/lib/active_record/railtie.rb +5 -6
  86. data/lib/active_record/railties/databases.rake +1 -2
  87. data/lib/active_record/reflection.rb +9 -7
  88. data/lib/active_record/relation/batches/batch_enumerator.rb +4 -3
  89. data/lib/active_record/relation/batches.rb +132 -72
  90. data/lib/active_record/relation/calculations.rb +55 -55
  91. data/lib/active_record/relation/delegation.rb +25 -14
  92. data/lib/active_record/relation/finder_methods.rb +31 -32
  93. data/lib/active_record/relation/merger.rb +8 -8
  94. data/lib/active_record/relation/predicate_builder/association_query_value.rb +0 -2
  95. data/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +1 -1
  96. data/lib/active_record/relation/predicate_builder/relation_handler.rb +4 -3
  97. data/lib/active_record/relation/predicate_builder.rb +5 -0
  98. data/lib/active_record/relation/query_attribute.rb +1 -1
  99. data/lib/active_record/relation/query_methods.rb +90 -91
  100. data/lib/active_record/relation/record_fetch_warning.rb +2 -2
  101. data/lib/active_record/relation/spawn_methods.rb +1 -1
  102. data/lib/active_record/relation/where_clause.rb +2 -8
  103. data/lib/active_record/relation.rb +77 -76
  104. data/lib/active_record/result.rb +68 -7
  105. data/lib/active_record/sanitization.rb +7 -6
  106. data/lib/active_record/schema_dumper.rb +16 -29
  107. data/lib/active_record/schema_migration.rb +2 -1
  108. data/lib/active_record/scoping/named.rb +5 -2
  109. data/lib/active_record/secure_token.rb +3 -3
  110. data/lib/active_record/signed_id.rb +6 -7
  111. data/lib/active_record/statement_cache.rb +12 -12
  112. data/lib/active_record/store.rb +7 -3
  113. data/lib/active_record/tasks/database_tasks.rb +24 -15
  114. data/lib/active_record/tasks/mysql_database_tasks.rb +0 -2
  115. data/lib/active_record/tasks/postgresql_database_tasks.rb +0 -7
  116. data/lib/active_record/tasks/sqlite_database_tasks.rb +2 -2
  117. data/lib/active_record/test_fixtures.rb +12 -0
  118. data/lib/active_record/testing/query_assertions.rb +2 -2
  119. data/lib/active_record/token_for.rb +1 -1
  120. data/lib/active_record/transactions.rb +1 -3
  121. data/lib/active_record/validations/uniqueness.rb +8 -8
  122. data/lib/active_record.rb +16 -1
  123. data/lib/arel/collectors/bind.rb +1 -1
  124. data/lib/arel/crud.rb +0 -2
  125. data/lib/arel/delete_manager.rb +0 -5
  126. data/lib/arel/nodes/delete_statement.rb +2 -4
  127. data/lib/arel/nodes/update_statement.rb +2 -4
  128. data/lib/arel/select_manager.rb +2 -6
  129. data/lib/arel/update_manager.rb +0 -5
  130. data/lib/arel/visitors/dot.rb +0 -2
  131. data/lib/arel/visitors/sqlite.rb +0 -25
  132. data/lib/arel/visitors/to_sql.rb +1 -3
  133. metadata +14 -11
data/CHANGELOG.md CHANGED
@@ -1,1459 +1,346 @@
1
- ## Rails 7.2.4 (September 24, 2026) ##
1
+ ## Rails 8.0.0.beta1 (September 26, 2024) ##
2
2
 
3
- * Fix performance regression in `method_missing` for virtual SELECT alias
4
- attributes.
3
+ * Allow `drop_table` to accept an array of table names.
5
4
 
6
- Fixes #57183.
7
-
8
- *Hammad Khan*
9
-
10
- * Fix support for table names containing hyphens.
11
-
12
- *Evgeniy Demin*
13
-
14
- * Improve PostgreSQLAdapter resilience to Timeout.timeout.
15
-
16
- Better handle asynchronous exceptions being thrown inside
17
- the `reconnect!` method.
18
-
19
- This may fixes some deep errors such as:
20
-
21
- ```
22
- undefined method `key?' for nil:NilClass (NoMethodError)
23
- if !type_map.key?(oid)
24
- ```
25
-
26
- *Jean Boussier*
27
-
28
- * Fix `eager_load` when loading `has_many` assocations with composite primary keys.
29
-
30
- This would result in some records being loaded multiple times.
31
-
32
- *Martin-Alexander*
33
-
34
-
35
- ## Rails 7.2.3.2 (July 29, 2026) ##
36
-
37
- * No changes.
38
-
39
-
40
- ## Rails 7.2.3.1 (March 23, 2026) ##
41
-
42
- * No changes.
43
-
44
-
45
- ## Rails 7.2.3 (October 28, 2025) ##
46
-
47
- * Fix SQLite3 data loss during table alterations with CASCADE foreign keys.
48
-
49
- When altering a table in SQLite3 that is referenced by child tables with
50
- `ON DELETE CASCADE` foreign keys, ActiveRecord would silently delete all
51
- data from the child tables. This occurred because SQLite requires table
52
- recreation for schema changes, and during this process the original table
53
- is temporarily dropped, triggering CASCADE deletes on child tables.
54
-
55
- The root cause was incorrect ordering of operations. The original code
56
- wrapped `disable_referential_integrity` inside a transaction, but
57
- `PRAGMA foreign_keys` cannot be modified inside a transaction in SQLite -
58
- attempting to do so simply has no effect. This meant foreign keys remained
59
- enabled during table recreation, causing CASCADE deletes to fire.
60
-
61
- The fix reverses the order to follow the official SQLite 12-step ALTER TABLE
62
- procedure: `disable_referential_integrity` now wraps the transaction instead
63
- of being wrapped by it. This ensures foreign keys are properly disabled
64
- before the transaction starts and re-enabled after it commits, preventing
65
- CASCADE deletes while maintaining data integrity through atomic transactions.
66
-
67
- *Ruy Rocha*
68
-
69
- * Fix `belongs_to` associations not to clear the entire composite primary key.
70
-
71
- When clearing a `belongs_to` association that references a model with composite primary key,
72
- only the optional part of the key should be cleared.
73
-
74
- *zzak*
75
-
76
- * Fix invalid records being autosaved when distantly associated records are marked for deletion.
77
-
78
- *Ian Terrell*, *axlekb AB*
79
-
80
- * Prevent persisting invalid record.
81
-
82
- *Edouard Chin*
83
-
84
- * Fix count with group by qualified name on loaded relation.
85
-
86
- *Ryuta Kamizono*
87
-
88
- * Fix `sum` with qualified name on loaded relation.
89
-
90
- *Chris Gunther*
91
-
92
- * Fix prepared statements on mysql2 adapter.
93
-
94
- *Jean Boussier*
95
-
96
- * Fix query cache for pinned connections in multi threaded transactional tests.
97
-
98
- When a pinned connection is used across separate threads, they now use a separate cache store
99
- for each thread.
100
-
101
- This improve accuracy of system tests, and any test using multiple threads.
102
-
103
- *Heinrich Lee Yu*, *Jean Boussier*
104
-
105
- * Don't add `id_value` attribute alias when attribute/column with that name already exists.
106
-
107
- *Rob Lewis*
108
-
109
- * Fix false positive change detection involving STI and polymorhic has one relationships.
110
-
111
- Polymorphic `has_one` relationships would always be considered changed when defined in a STI child
112
- class, causing nedless extra autosaves.
113
-
114
- *David Fritsch*
115
-
116
- * Fix stale associaton detection for polymophic `belong_to`.
117
-
118
- *Florent Beaurain*, *Thomas Crambert*
119
-
120
- * Fix removal of PostgreSQL version comments in `structure.sql` for latest PostgreSQL versions which include `\restrict`.
121
-
122
- *Brendan Weibrecht*
123
-
124
- * Fix `#merge` with `#or` or `#and` and a mixture of attributes and SQL strings resulting in an incorrect query.
125
-
126
- ```ruby
127
- base = Comment.joins(:post).where(user_id: 1).where("recent = 1")
128
- puts base.merge(base.where(draft: true).or(Post.where(archived: true))).to_sql
129
- ```
130
-
131
- Before:
132
-
133
- ```SQL
134
- SELECT "comments".* FROM "comments"
135
- INNER JOIN "posts" ON "posts"."id" = "comments"."post_id"
136
- WHERE (recent = 1)
137
- AND (
138
- "comments"."user_id" = 1
139
- AND (recent = 1)
140
- AND "comments"."draft" = 1
141
- OR "posts"."archived" = 1
142
- )
143
- ```
144
-
145
- After:
146
-
147
- ```SQL
148
- SELECT "comments".* FROM "comments"
149
- INNER JOIN "posts" ON "posts"."id" = "comments"."post_id"
150
- WHERE "comments"."user_id" = 1
151
- AND (recent = 1)
152
- AND (
153
- "comments"."user_id" = 1
154
- AND (recent = 1)
155
- AND "comments"."draft" = 1
156
- OR "posts"."archived" = 1
157
- )
158
- ```
159
-
160
- *Joshua Young*
161
-
162
- * Fix inline `has_and_belongs_to_many` fixtures for tables with composite primary keys.
163
-
164
- *fatkodima*
165
-
166
- * Fix `annotate` comments to propagate to `update_all`/`delete_all`.
167
-
168
- *fatkodima*
169
-
170
- * Fix checking whether an unpersisted record is `include?`d in a strictly
171
- loaded `has_and_belongs_to_many` association.
172
-
173
- *Hartley McGuire*
174
-
175
- * Fix inline has_and_belongs_to_many fixtures for tables with composite primary keys.
176
-
177
- *fatkodima*
178
-
179
- * `create_or_find_by` will now correctly rollback a transaction.
180
-
181
- When using `create_or_find_by`, raising a ActiveRecord::Rollback error
182
- in a `after_save` callback had no effect, the transaction was committed
183
- and a record created.
184
-
185
- *Edouard Chin*
186
-
187
- * Gracefully handle `Timeout.timeout` firing during connection configuration.
188
-
189
- Use of `Timeout.timeout` could result in improperly initialized database connection.
190
-
191
- This could lead to a partially configured connection being used, resulting in various exceptions,
192
- the most common being with the PostgreSQLAdapter raising `undefined method 'key?' for nil`
193
- or `TypeError: wrong argument type nil (expected PG::TypeMap)`.
194
-
195
- *Jean Boussier*
196
-
197
- * The SQLite3 adapter quotes non-finite Numeric values like "Infinity" and "NaN".
198
-
199
- *Mike Dalessio*
200
-
201
- * Handle libpq returning a database version of 0 on no/bad connection in `PostgreSQLAdapter`.
202
-
203
- Before, this version would be cached and an error would be raised during connection configuration when
204
- comparing it with the minimum required version for the adapter. This meant that the connection could
205
- never be successfully configured on subsequent reconnection attempts.
206
-
207
- Now, this is treated as a connection failure consistent with libpq, raising a `ActiveRecord::ConnectionFailed`
208
- and ensuring the version isn't cached, which allows the version to be retrieved on the next connection attempt.
209
-
210
- *Joshua Young*, *Rian McGuire*
211
-
212
- * Fix error handling during connection configuration.
213
-
214
- Active Record wasn't properly handling errors during the connection configuration phase.
215
- This could lead to a partially configured connection being used, resulting in various exceptions,
216
- the most common being with the PostgreSQLAdapter raising `undefined method `key?' for nil`
217
- or `TypeError: wrong argument type nil (expected PG::TypeMap)`.
218
-
219
- *Jean Boussier*
220
-
221
- * Fix a case where a non-retryable query could be marked retryable.
222
-
223
- *Hartley McGuire*
224
-
225
- * Handle circular references when autosaving associations.
226
-
227
- *zzak*
228
-
229
- * Prevent persisting invalid record.
230
-
231
- *Edouard Chin*
232
-
233
- * Fix support for PostgreSQL enum types with commas in their name.
234
-
235
- *Arthur Hess*
236
-
237
- * Fix inserts on MySQL with no RETURNING support for a table with multiple auto populated columns.
238
-
239
- *Nikita Vasilevsky*
240
-
241
- * Fix joining on a scoped association with string joins and bind parameters.
242
-
243
- ```ruby
244
- class Instructor < ActiveRecord::Base
245
- has_many :instructor_roles, -> { active }
246
- end
247
-
248
- class InstructorRole < ActiveRecord::Base
249
- scope :active, -> {
250
- joins("JOIN students ON instructor_roles.student_id = students.id")
251
- .where(students { status: 1 })
252
- }
253
- end
254
-
255
- Instructor.joins(:instructor_roles).first
256
- ```
257
-
258
- The above example would result in `ActiveRecord::StatementInvalid` because the
259
- `active` scope bind parameters would be lost.
260
-
261
- *Jean Boussier*
262
-
263
- * Fix a potential race condition with system tests and transactional fixtures.
264
-
265
- *Sjoerd Lagarde*
266
-
267
- * Fix count with group by qualified name on loaded relation.
268
-
269
- *Ryuta Kamizono*
270
-
271
- * Fix sum with qualified name on loaded relation.
272
-
273
- *Chris Gunther*
274
-
275
- * Fix autosave associations to no longer validated unmodified associated records.
276
-
277
- Active Record was incorrectly performing validation on associated record that
278
- weren't created nor modified as part of the transaction:
279
-
280
- ```ruby
281
- Post.create!(author: User.find(1)) # Fail if user is invalid
282
- ```
283
-
284
- *Jean Boussier*
285
-
286
- * Remember when a database connection has recently been verified (for
287
- two seconds, by default), to avoid repeated reverifications during a
288
- single request.
289
-
290
- This should recreate a similar rate of verification as in Rails 7.1,
291
- where connections are leased for the duration of a request, and thus
292
- only verified once.
293
-
294
- *Matthew Draper*
295
-
296
- * Fix prepared statements on mysql2 adapter.
297
-
298
- *Jean Boussier*
299
-
300
- * Fix a race condition in `ActiveRecord::Base#method_missing` when lazily defining attributes.
301
-
302
- If multiple thread were concurrently triggering attribute definition on the same model,
303
- it could result in a `NoMethodError` being raised.
304
-
305
- *Jean Boussier*
306
-
307
- * Fix MySQL default functions getting dropped when changing a column's nullability.
308
-
309
- *Bastian Bartmann*
310
-
311
- * Fix `add_unique_constraint`/`add_check_constraint`/`/`add_foreign_key` to be revertible when
312
- given invalid options.
313
-
314
- *fatkodima*
315
-
316
- * Fix asynchronous destroying of polymorphic `belongs_to` associations.
317
-
318
- *fatkodima*
319
-
320
- * NOT VALID constraints should not dump in `create_table`.
321
-
322
- *Ryuta Kamizono*
323
-
324
- * Fix finding by nil composite primary key association.
325
-
326
- *fatkodima*
327
-
328
- * Fix parsing of SQLite foreign key names when they contain non-ASCII characters
329
-
330
- *Zacharias Knudsen*
331
-
332
- * Fix parsing of MySQL 8.0.16+ CHECK constraints when they contain new lines.
333
-
334
- *Steve Hill*
335
-
336
- * Ensure normalized attribute queries use `IS NULL` consistently for `nil` and normalized `nil` values.
337
-
338
- *Joshua Young*
339
-
340
- * Restore back the ability to pass only database name for `DATABASE_URL`.
341
-
342
- *fatkodima*
343
-
344
- * Fix `order` with using association name as an alias.
345
-
346
- *Ryuta Kamizono*
347
-
348
- * Improve invalid argument error for with.
349
-
350
- *Ryuta Kamizono*
351
-
352
- * Deduplicate `with` CTE expressions.
353
-
354
- *fatkodima*
355
-
356
-
357
- ## Rails 7.2.2.2 (August 13, 2025) ##
358
-
359
- * Call inspect on ids in RecordNotFound error
360
-
361
- [CVE-2025-55193]
362
-
363
- *Gannon McGibbon*, *John Hawthorn*
364
-
365
-
366
- ## Rails 7.2.2.1 (December 10, 2024) ##
367
-
368
- * No changes.
369
-
370
-
371
- ## Rails 7.2.2 (October 30, 2024) ##
372
-
373
- * Fix support for `query_cache: false` in `database.yml`.
374
-
375
- `query_cache: false` would no longer entirely disable the Active Record query cache.
376
-
377
- *zzak*
378
-
379
- * Set `.attributes_for_inspect` to `:all` by default.
380
-
381
- For new applications it is set to `[:id]` in config/environment/production.rb.
382
-
383
- In the console all the attributes are always shown.
384
-
385
- *Andrew Novoselac*
386
-
387
- * `PG::UnableToSend: no connection to the server` is now retryable as a connection-related exception
388
-
389
- *Kazuma Watanabe*
390
-
391
- * Fix marshalling of unsaved associated records in 7.1 format.
392
-
393
- The 7.1 format would only marshal associated records if the association was loaded.
394
- But associations that would only contain unsaved records would be skipped.
395
-
396
- *Jean Boussier*
397
-
398
- * Fix incorrect SQL query when passing an empty hash to `ActiveRecord::Base.insert`.
399
-
400
- *David Stosik*
401
-
402
- * Allow to save records with polymorphic join tables that have `inverse_of`
403
- specified.
404
-
405
- *Markus Doits*
406
-
407
- * Fix association scopes applying on the incorrect join when using a polymorphic `has_many through:`.
408
-
409
- *Joshua Young*
410
-
411
- * Fix `dependent: :destroy` for bi-directional has one through association.
412
-
413
- Fixes #50948.
414
-
415
- ```ruby
416
- class Left < ActiveRecord::Base
417
- has_one :middle, dependent: :destroy
418
- has_one :right, through: :middle
419
- end
420
-
421
- class Middle < ActiveRecord::Base
422
- belongs_to :left, dependent: :destroy
423
- belongs_to :right, dependent: :destroy
424
- end
425
-
426
- class Right < ActiveRecord::Base
427
- has_one :middle, dependent: :destroy
428
- has_one :left, through: :middle
429
- end
430
- ```
431
- In the above example `left.destroy` wouldn't destroy its associated `Right`
432
- record.
433
-
434
- *Andy Stewart*
435
-
436
- * Properly handle lazily pinned connection pools.
437
-
438
- Fixes #53147.
439
-
440
- When using transactional fixtures with system tests to similar tools
441
- such as capybara, it could happen that a connection end up pinned by the
442
- server thread rather than the test thread, causing
443
- `"Cannot expire connection, it is owned by a different thread"` errors.
444
-
445
- *Jean Boussier*
446
-
447
- * Fix `ActiveRecord::Base.with` to accept more than two sub queries.
448
-
449
- Fixes #53110.
450
-
451
- ```ruby
452
- User.with(foo: [User.select(:id), User.select(:id), User.select(:id)]).to_sql
453
- undefined method `union' for an instance of Arel::Nodes::UnionAll (NoMethodError)
454
- ```
455
-
456
- The above now works as expected.
457
-
458
- *fatkodima*
459
-
460
- * Properly release pinned connections with non joinable connections.
461
-
462
- Fixes #52973
463
-
464
- When running system tests with transactional fixtures on, it could happen that
465
- the connection leased by the Puma thread wouldn't be properly released back to the pool,
466
- causing "Cannot expire connection, it is owned by a different thread" errors in later tests.
467
-
468
- *Jean Boussier*
469
-
470
- * Make Float distinguish between `float4` and `float8` in PostgreSQL.
471
-
472
- Fixes #52742
473
-
474
- *Ryota Kitazawa*, *Takayuki Nagatomi*
475
-
476
- * Fix an issue where `.left_outer_joins` used with multiple associations that have
477
- the same child association but different parents does not join all parents.
478
-
479
- Previously, using `.left_outer_joins` with the same child association would only join one of the parents.
480
-
481
- Now it will correctly join both parents.
482
-
483
- Fixes #41498.
484
-
485
- *Garrett Blehm*
486
-
487
- * Ensure `ActiveRecord::Encryption.config` is always ready before access.
488
-
489
- Previously, `ActiveRecord::Encryption` configuration was deferred until `ActiveRecord::Base`
490
- was loaded. Therefore, accessing `ActiveRecord::Encryption.config` properties before
491
- `ActiveRecord::Base` was loaded would give incorrect results.
492
-
493
- `ActiveRecord::Encryption` now has its own loading hook so that its configuration is set as
494
- soon as needed.
495
-
496
- When `ActiveRecord::Base` is loaded, even lazily, it in turn triggers the loading of
497
- `ActiveRecord::Encryption`, thus preserving the original behavior of having its config ready
498
- before any use of `ActiveRecord::Base`.
499
-
500
- *Maxime Réty*
501
-
502
- * Add `TimeZoneConverter#==` method, so objects will be properly compared by
503
- their type, scale, limit & precision.
504
-
505
- Address #52699.
506
-
507
- *Ruy Rocha*
508
-
509
-
510
- ## Rails 7.2.1.2 (October 23, 2024) ##
511
-
512
- * No changes.
513
-
514
-
515
- ## Rails 7.2.1.1 (October 15, 2024) ##
516
-
517
- * No changes.
518
-
519
-
520
- ## Rails 7.2.1 (August 22, 2024) ##
521
-
522
- * Fix detection for `enum` columns with parallelized tests and PostgreSQL.
523
-
524
- *Rafael Mendonça França*
525
-
526
- * Allow to eager load nested nil associations.
527
-
528
- *fatkodima*
529
-
530
- * Fix swallowing ignore order warning when batching using `BatchEnumerator`.
531
-
532
- *fatkodima*
533
-
534
- * Fix memory bloat on the connection pool when using the Fiber `IsolatedExecutionState`.
535
-
536
- *Jean Boussier*
537
-
538
- * Restore inferred association class with the same modularized name.
539
-
540
- *Justin Ko*
541
-
542
- * Fix `ActiveRecord::Base.inspect` to properly explain how to load schema information.
543
-
544
- *Jean Boussier*
545
-
546
- * Check invalid `enum` options for the new syntax.
547
-
548
- The options using `_` prefix in the old syntax are invalid in the new syntax.
549
-
550
- *Rafael Mendonça França*
551
-
552
- * Fix `ActiveRecord::Encryption::EncryptedAttributeType#type` to return
553
- actual cast type.
554
-
555
- *Vasiliy Ermolovich*
556
-
557
- * Fix `create_table` with `:auto_increment` option for MySQL adapter.
558
-
559
- *fatkodima*
560
-
561
-
562
- ## Rails 7.2.0 (August 09, 2024) ##
563
-
564
- * Handle commas in Sqlite3 default function definitions.
565
-
566
- *Stephen Margheim*
567
-
568
- * Fixes `validates_associated` raising an exception when configured with a
569
- singular association and having `index_nested_attribute_errors` enabled.
570
-
571
- *Martin Spickermann*
572
-
573
- * The constant `ActiveRecord::ImmutableRelation` has been deprecated because
574
- we want to reserve that name for a stronger sense of "immutable relation".
575
- Please use `ActiveRecord::UnmodifiableRelation` instead.
576
-
577
- *Xavier Noria*
578
-
579
- * Add condensed `#inspect` for `ConnectionPool`, `AbstractAdapter`, and
580
- `DatabaseConfig`.
581
-
582
- *Hartley McGuire*
583
-
584
- * Fixed a memory performance issue in Active Record attribute methods definition.
585
-
586
- *Jean Boussier*
587
-
588
- * Define the new Active Support notification event `start_transaction.active_record`.
589
-
590
- This event is fired when database transactions or savepoints start, and
591
- complements `transaction.active_record`, which is emitted when they finish.
592
-
593
- The payload has the transaction (`:transaction`) and the connection (`:connection`).
594
-
595
- *Xavier Noria*
596
-
597
- * Fix an issue where the IDs reader method did not return expected results
598
- for preloaded associations in models using composite primary keys.
599
-
600
- *Jay Ang*
601
-
602
- * The payload of `sql.active_record` Active Support notifications now has the current transaction in the `:transaction` key.
603
-
604
- *Xavier Noria*
605
-
606
- * The payload of `transaction.active_record` Active Support notifications now has the transaction the event is related to in the `:transaction` key.
607
-
608
- *Xavier Noria*
609
-
610
- * Define `ActiveRecord::Transaction#uuid`, which returns a UUID for the database transaction. This may be helpful when tracing database activity. These UUIDs are generated only on demand.
611
-
612
- *Xavier Noria*
613
-
614
- * Fix inference of association model on nested models with the same demodularized name.
615
-
616
- E.g. with the following setup:
617
-
618
- ```ruby
619
- class Nested::Post < ApplicationRecord
620
- has_one :post, through: :other
621
- end
622
- ```
623
-
624
- Before, `#post` would infer the model as `Nested::Post`, but now it correctly infers `Post`.
625
-
626
- *Joshua Young*
627
-
628
- * PostgreSQL `Cidr#change?` detects the address prefix change.
629
-
630
- *Taketo Takashima*
631
-
632
- * Change `BatchEnumerator#destroy_all` to return the total number of affected rows.
633
-
634
- Previously, it always returned `nil`.
635
-
636
- *fatkodima*
637
-
638
- * Support `touch_all` in batches.
639
-
640
- ```ruby
641
- Post.in_batches.touch_all
642
- ```
643
-
644
- *fatkodima*
645
-
646
- * Add support for `:if_not_exists` and `:force` options to `create_schema`.
647
-
648
- *fatkodima*
649
-
650
- * Fix `index_errors` having incorrect index in association validation errors.
651
-
652
- *lulalala*
653
-
654
- * Add `index_errors: :nested_attributes_order` mode.
655
-
656
- This indexes the association validation errors based on the order received by nested attributes setter, and respects the `reject_if` configuration. This enables API to provide enough information to the frontend to map the validation errors back to their respective form fields.
657
-
658
- *lulalala*
659
-
660
- * Add `Rails.application.config.active_record.postgresql_adapter_decode_dates` to opt out of decoding dates automatically with the postgresql adapter. Defaults to true.
661
-
662
- *Joé Dupuis*
663
-
664
- * Association option `query_constraints` is deprecated in favor of `foreign_key`.
665
-
666
- *Nikita Vasilevsky*
667
-
668
- * Add `ENV["SKIP_TEST_DATABASE_TRUNCATE"]` flag to speed up multi-process test runs on large DBs when all tests run within default transaction.
669
-
670
- This cuts ~10s from the test run of HEY when run by 24 processes against the 178 tables, since ~4,000 table truncates can then be skipped.
671
-
672
- *DHH*
673
-
674
- * Added support for recursive common table expressions.
675
-
676
- ```ruby
677
- Post.with_recursive(
678
- post_and_replies: [
679
- Post.where(id: 42),
680
- Post.joins('JOIN post_and_replies ON posts.in_reply_to_id = post_and_replies.id'),
681
- ]
682
- )
683
- ```
684
-
685
- Generates the following SQL:
686
-
687
- ```sql
688
- WITH RECURSIVE "post_and_replies" AS (
689
- (SELECT "posts".* FROM "posts" WHERE "posts"."id" = 42)
690
- UNION ALL
691
- (SELECT "posts".* FROM "posts" JOIN post_and_replies ON posts.in_reply_to_id = post_and_replies.id)
692
- )
693
- SELECT "posts".* FROM "posts"
694
- ```
695
-
696
- *ClearlyClaire*
697
-
698
- * `validate_constraint` can be called in a `change_table` block.
699
-
700
- ex:
701
- ```ruby
702
- change_table :products do |t|
703
- t.check_constraint "price > discounted_price", name: "price_check", validate: false
704
- t.validate_check_constraint "price_check"
705
- end
706
- ```
707
-
708
- *Cody Cutrer*
709
-
710
- * `PostgreSQLAdapter` now decodes columns of type date to `Date` instead of string.
711
-
712
- Ex:
713
- ```ruby
714
- ActiveRecord::Base.connection
715
- .select_value("select '2024-01-01'::date").class #=> Date
716
- ```
717
-
718
- *Joé Dupuis*
719
-
720
- * Strict loading using `:n_plus_one_only` does not eagerly load child associations.
721
-
722
- With this change, child associations are no longer eagerly loaded, to
723
- match intended behavior and to prevent non-deterministic order issues caused
724
- by calling methods like `first` or `last`. As `first` and `last` don't cause
725
- an N+1 by themselves, calling child associations will no longer raise.
726
- Fixes #49473.
727
-
728
- Before:
729
-
730
- ```ruby
731
- person = Person.find(1)
732
- person.strict_loading!(mode: :n_plus_one_only)
733
- person.posts.first
734
- # SELECT * FROM posts WHERE person_id = 1; -- non-deterministic order
735
- person.posts.first.firm # raises ActiveRecord::StrictLoadingViolationError
736
- ```
737
-
738
- After:
739
-
740
- ```ruby
741
- person = Person.find(1)
742
- person.strict_loading!(mode: :n_plus_one_only)
743
- person.posts.first # this is 1+1, not N+1
744
- # SELECT * FROM posts WHERE person_id = 1 ORDER BY id LIMIT 1;
745
- person.posts.first.firm # no longer raises
746
- ```
747
-
748
- *Reid Lynch*
749
-
750
- * Allow `Sqlite3Adapter` to use `sqlite3` gem version `2.x`.
751
-
752
- *Mike Dalessio*
753
-
754
- * Allow `ActiveRecord::Base#pluck` to accept hash values.
755
-
756
- ```ruby
757
- # Before
758
- Post.joins(:comments).pluck("posts.id", "comments.id", "comments.body")
759
-
760
- # After
761
- Post.joins(:comments).pluck(posts: [:id], comments: [:id, :body])
762
- ```
763
-
764
- *fatkodima*
765
-
766
- * Raise an `ActiveRecord::ActiveRecordError` error when the MySQL database returns an invalid version string.
767
-
768
- *Kevin McPhillips*
769
-
770
- * `ActiveRecord::Base.transaction` now yields an `ActiveRecord::Transaction` object.
771
-
772
- This allows to register callbacks on it.
773
-
774
- ```ruby
775
- Article.transaction do |transaction|
776
- article.update(published: true)
777
- transaction.after_commit do
778
- PublishNotificationMailer.with(article: article).deliver_later
779
- end
780
- end
781
- ```
782
-
783
- *Jean Boussier*
784
-
785
- * Add `ActiveRecord::Base.current_transaction`.
786
-
787
- Returns the current transaction, to allow registering callbacks on it.
788
-
789
- ```ruby
790
- Article.current_transaction.after_commit do
791
- PublishNotificationMailer.with(article: article).deliver_later
792
- end
793
- ```
794
-
795
- *Jean Boussier*
796
-
797
- * Add `ActiveRecord.after_all_transactions_commit` callback.
798
-
799
- Useful for code that may run either inside or outside a transaction and needs
800
- to perform work after the state changes have been properly persisted.
801
-
802
- ```ruby
803
- def publish_article(article)
804
- article.update(published: true)
805
- ActiveRecord.after_all_transactions_commit do
806
- PublishNotificationMailer.with(article: article).deliver_later
807
- end
808
- end
809
- ```
810
-
811
- In the above example, the block is either executed immediately if called outside
812
- of a transaction, or called after the open transaction is committed.
813
-
814
- If the transaction is rolled back, the block isn't called.
815
-
816
- *Jean Boussier*
817
-
818
- * Add the ability to ignore counter cache columns until they are backfilled.
819
-
820
- Starting to use counter caches on existing large tables can be troublesome, because the column
821
- values must be backfilled separately of the column addition (to not lock the table for too long)
822
- and before the use of `:counter_cache` (otherwise methods like `size`/`any?`/etc, which use
823
- counter caches internally, can produce incorrect results). People usually use database triggers
824
- or callbacks on child associations while backfilling before introducing a counter cache
825
- configuration to the association.
826
-
827
- Now, to safely backfill the column, while keeping the column updated with child records added/removed, use:
5
+ This will let you to drop multiple tables in a single call.
828
6
 
829
7
  ```ruby
830
- class Comment < ApplicationRecord
831
- belongs_to :post, counter_cache: { active: false }
832
- end
8
+ ActiveRecord::Base.lease_connection.drop_table(:users, :posts)
833
9
  ```
834
10
 
835
- While the counter cache is not "active", the methods like `size`/`any?`/etc will not use it,
836
- but get the results directly from the database. After the counter cache column is backfilled, simply
837
- remove the `{ active: false }` part from the counter cache definition, and it will now be used by the
838
- mentioned methods.
839
-
840
- *fatkodima*
841
-
842
- * Retry known idempotent SELECT queries on connection-related exceptions.
843
-
844
- SELECT queries we construct by walking the Arel tree and / or with known model attributes
845
- are idempotent and can safely be retried in the case of a connection error. Previously,
846
- adapters such as `TrilogyAdapter` would raise `ActiveRecord::ConnectionFailed: Trilogy::EOFError`
847
- when encountering a connection error mid-request.
848
-
849
- *Adrianna Chang*
850
-
851
- * Allow association's `foreign_key` to be composite.
852
-
853
- `query_constraints` option was the only way to configure a composite foreign key by passing an `Array`.
854
- Now it's possible to pass an Array value as `foreign_key` to achieve the same behavior of an association.
855
-
856
- *Nikita Vasilevsky*
857
-
858
- * Allow association's `primary_key` to be composite.
11
+ *Gabriel Sobrinho*
859
12
 
860
- Association's `primary_key` can be composite when derived from associated model `primary_key` or `query_constraints`.
861
- Now it's possible to explicitly set it as composite on the association.
13
+ * Add support for PostgreSQL `IF NOT EXISTS` via the `:if_not_exists` option
14
+ on the `add_enum_value` method.
862
15
 
863
- *Nikita Vasilevsky*
16
+ *Ariel Rzezak*
864
17
 
865
- * Add `config.active_record.permanent_connection_checkout` setting.
18
+ * When running `db:migrate` on a fresh database, load the database schema before running migrations.
866
19
 
867
- Controls whether `ActiveRecord::Base.connection` raises an error, emits a deprecation warning, or neither.
868
-
869
- `ActiveRecord::Base.connection` checkouts a database connection from the pool and keeps it leased until the end of
870
- the request or job. This behavior can be undesirable in environments that use many more threads or fibers than there
871
- is available connections.
872
-
873
- This configuration can be used to track down and eliminate code that calls `ActiveRecord::Base.connection` and
874
- migrate it to use `ActiveRecord::Base.with_connection` instead.
875
-
876
- The default behavior remains unchanged, and there is currently no plans to change the default.
20
+ *Andrew Novoselac*
877
21
 
878
- *Jean Boussier*
22
+ * Fix an issue where `.left_outer_joins` used with multiple associations that have
23
+ the same child association but different parents does not join all parents.
879
24
 
880
- * Add dirties option to uncached.
25
+ Previously, using `.left_outer_joins` with the same child association would only join one of the parents.
881
26
 
882
- This adds a `dirties` option to `ActiveRecord::Base.uncached` and
883
- `ActiveRecord::ConnectionAdapters::ConnectionPool#uncached`.
27
+ Now it will correctly join both parents.
884
28
 
885
- When set to `true` (the default), writes will clear all query caches belonging to the current thread.
886
- When set to `false`, writes to the affected connection pool will not clear any query cache.
29
+ Fixes #41498.
887
30
 
888
- This is needed by Solid Cache so that cache writes do not clear query caches.
31
+ *Garrett Blehm*
889
32
 
890
- *Donal McBreen*
33
+ * Deprecate `unsigned_float` and `unsigned_decimal` short-hand column methods.
891
34
 
892
- * Deprecate `ActiveRecord::Base.connection` in favor of `.lease_connection`.
35
+ As of MySQL 8.0.17, the UNSIGNED attribute is deprecated for columns of type FLOAT, DOUBLE,
36
+ and DECIMAL. Consider using a simple CHECK constraint instead for such columns.
893
37
 
894
- The method has been renamed as `lease_connection` to better reflect that the returned
895
- connection will be held for the duration of the request or job.
38
+ https://dev.mysql.com/doc/refman/8.0/en/numeric-type-syntax.html
896
39
 
897
- This deprecation is a soft deprecation, no warnings will be issued and there is no
898
- current plan to remove the method.
40
+ *Ryuta Kamizono*
899
41
 
900
- *Jean Boussier*
42
+ * Drop MySQL 5.5 support.
901
43
 
902
- * Deprecate `ActiveRecord::ConnectionAdapters::ConnectionPool#connection`.
44
+ MySQL 5.5 is the only version that does not support datetime with precision,
45
+ which we have supported in the core. Now we support MySQL 5.6.4 or later, which
46
+ is the first version to support datetime with precision.
903
47
 
904
- The method has been renamed as `lease_connection` to better reflect that the returned
905
- connection will be held for the duration of the request or job.
48
+ *Ryuta Kamizono*
906
49
 
907
- *Jean Boussier*
50
+ * Make Active Record asynchronous queries compatible with transactional fixtures.
908
51
 
909
- * Expose a generic fixture accessor for fixture names that may conflict with Minitest.
52
+ Previously transactional fixtures would disable asynchronous queries, because transactional
53
+ fixtures impose all queries use the same connection.
910
54
 
911
- ```ruby
912
- assert_equal "Ruby on Rails", web_sites(:rubyonrails).name
913
- assert_equal "Ruby on Rails", fixture(:web_sites, :rubyonrails).name
914
- ```
55
+ Now asynchronous queries will use the connection pinned by transactional fixtures, and behave
56
+ much closer to production.
915
57
 
916
58
  *Jean Boussier*
917
59
 
918
- * Using `Model.query_constraints` with a single non-primary-key column used to raise as expected, but with an
919
- incorrect error message.
920
-
921
- This has been fixed to raise with a more appropriate error message.
922
-
923
- *Joshua Young*
924
-
925
- * Fix `has_one` association autosave setting the foreign key attribute when it is unchanged.
926
-
927
- This behavior is also inconsistent with autosaving `belongs_to` and can have unintended side effects like raising
928
- an `ActiveRecord::ReadonlyAttributeError` when the foreign key attribute is marked as read-only.
929
-
930
- *Joshua Young*
931
-
932
- * Remove deprecated behavior that would rollback a transaction block when exited using `return`, `break` or `throw`.
933
-
934
- *Rafael Mendonça França*
935
-
936
- * Deprecate `Rails.application.config.active_record.commit_transaction_on_non_local_return`.
937
-
938
- *Rafael Mendonça França*
939
-
940
- * Remove deprecated support to pass `rewhere` to `ActiveRecord::Relation#merge`.
941
-
942
- *Rafael Mendonça França*
943
-
944
- * Remove deprecated support to pass `deferrable: true` to `add_foreign_key`.
945
-
946
- *Rafael Mendonça França*
947
-
948
- * Remove deprecated support to quote `ActiveSupport::Duration`.
949
-
950
- *Rafael Mendonça França*
951
-
952
- * Remove deprecated `#quote_bound_value`.
953
-
954
- *Rafael Mendonça França*
955
-
956
- * Remove deprecated `ActiveRecord::ConnectionAdapters::ConnectionPool#connection_klass`.
957
-
958
- *Rafael Mendonça França*
959
-
960
- * Remove deprecated support to apply `#connection_pool_list`, `#active_connections?`, `#clear_active_connections!`,
961
- `#clear_reloadable_connections!`, `#clear_all_connections!` and `#flush_idle_connections!` to the connections pools
962
- for the current role when the `role` argument isn't provided.
963
-
964
- *Rafael Mendonça França*
965
-
966
- * Remove deprecated `#all_connection_pools`.
967
-
968
- *Rafael Mendonça França*
969
-
970
- * Remove deprecated `ActiveRecord::ConnectionAdapters::SchemaCache#data_sources`.
971
-
972
- *Rafael Mendonça França*
973
-
974
- * Remove deprecated `ActiveRecord::ConnectionAdapters::SchemaCache.load_from`.
975
-
976
- *Rafael Mendonça França*
977
-
978
- * Remove deprecated `#all_foreign_keys_valid?` from database adapters.
979
-
980
- *Rafael Mendonça França*
981
-
982
- * Remove deprecated support to passing coder and class as second argument to `serialize`.
983
-
984
- *Rafael Mendonça França*
985
-
986
- * Remove deprecated support to `ActiveRecord::Base#read_attribute(:id)` to return the custom primary key value.
987
-
988
- *Rafael Mendonça França*
989
-
990
- * Remove deprecated `TestFixtures.fixture_path`.
991
-
992
- *Rafael Mendonça França*
993
-
994
- * Remove deprecated behavior to support referring to a singular association by its plural name.
995
-
996
- *Rafael Mendonça França*
997
-
998
- * Deprecate `Rails.application.config.active_record.allow_deprecated_singular_associations_name`.
999
-
1000
- *Rafael Mendonça França*
1001
-
1002
- * Remove deprecated support to passing `SchemaMigration` and `InternalMetadata` classes as arguments to
1003
- `ActiveRecord::MigrationContext`.
1004
-
1005
- *Rafael Mendonça França*
1006
-
1007
- * Remove deprecated `ActiveRecord::Migration.check_pending!` method.
1008
-
1009
- *Rafael Mendonça França*
1010
-
1011
- * Remove deprecated `ActiveRecord::LogSubscriber.runtime` method.
1012
-
1013
- *Rafael Mendonça França*
1014
-
1015
- * Remove deprecated `ActiveRecord::LogSubscriber.runtime=` method.
1016
-
1017
- *Rafael Mendonça França*
1018
-
1019
- * Remove deprecated `ActiveRecord::LogSubscriber.reset_runtime` method.
1020
-
1021
- *Rafael Mendonça França*
1022
-
1023
- * Remove deprecated support to define `explain` in the connection adapter with 2 arguments.
1024
-
1025
- *Rafael Mendonça França*
1026
-
1027
- * Remove deprecated `ActiveRecord::ActiveJobRequiredError`.
1028
-
1029
- *Rafael Mendonça França*
1030
-
1031
- * Remove deprecated `ActiveRecord::Base.clear_active_connections!`.
1032
-
1033
- *Rafael Mendonça França*
1034
-
1035
- * Remove deprecated `ActiveRecord::Base.clear_reloadable_connections!`.
1036
-
1037
- *Rafael Mendonça França*
1038
-
1039
- * Remove deprecated `ActiveRecord::Base.clear_all_connections!`.
1040
-
1041
- *Rafael Mendonça França*
1042
-
1043
- * Remove deprecated `ActiveRecord::Base.flush_idle_connections!`.
60
+ * Deserialize binary data before decrypting
1044
61
 
1045
- *Rafael Mendonça França*
1046
-
1047
- * Remove deprecated `name` argument from `ActiveRecord::Base.remove_connection`.
1048
-
1049
- *Rafael Mendonça França*
1050
-
1051
- * Remove deprecated support to call `alias_attribute` with non-existent attribute names.
1052
-
1053
- *Rafael Mendonça França*
1054
-
1055
- * Remove deprecated `Rails.application.config.active_record.suppress_multiple_database_warning`.
1056
-
1057
- *Rafael Mendonça França*
1058
-
1059
- * Add `ActiveRecord::Encryption::MessagePackMessageSerializer`.
1060
-
1061
- Serialize data to the MessagePack format, for efficient storage in binary columns.
1062
-
1063
- The binary encoding requires around 30% less space than the base64 encoding
1064
- used by the default serializer.
62
+ This ensures that we call `PG::Connection.unescape_bytea` on PostgreSQL before decryption.
1065
63
 
1066
64
  *Donal McBreen*
1067
65
 
1068
- * Add support for encrypting binary columns.
1069
-
1070
- Ensure encryption and decryption pass `Type::Binary::Data` around for binary data.
66
+ * Ensure `ActiveRecord::Encryption.config` is always ready before access.
1071
67
 
1072
- Previously encrypting binary columns with the `ActiveRecord::Encryption::MessageSerializer`
1073
- incidentally worked for MySQL and SQLite, but not PostgreSQL.
68
+ Previously, `ActiveRecord::Encryption` configuration was deferred until `ActiveRecord::Base`
69
+ was loaded. Therefore, accessing `ActiveRecord::Encryption.config` properties before
70
+ `ActiveRecord::Base` was loaded would give incorrect results.
1074
71
 
1075
- *Donal McBreen*
72
+ `ActiveRecord::Encryption` now has its own loading hook so that its configuration is set as
73
+ soon as needed.
1076
74
 
1077
- * Deprecated `ENV["SCHEMA_CACHE"]` in favor of `schema_cache_path` in the database configuration.
75
+ When `ActiveRecord::Base` is loaded, even lazily, it in turn triggers the loading of
76
+ `ActiveRecord::Encryption`, thus preserving the original behavior of having its config ready
77
+ before any use of `ActiveRecord::Base`.
1078
78
 
1079
- *Rafael Mendonça França*
79
+ *Maxime Réty*
1080
80
 
1081
- * Add `ActiveRecord::Base.with_connection` as a shortcut for leasing a connection for a short duration.
81
+ * Add `TimeZoneConverter#==` method, so objects will be properly compared by
82
+ their type, scale, limit & precision.
1082
83
 
1083
- The leased connection is yielded, and for the duration of the block, any call to `ActiveRecord::Base.connection`
1084
- will yield that same connection.
84
+ Address #52699.
1085
85
 
1086
- This is useful to perform a few database operations without causing a connection to be leased for the
1087
- entire duration of the request or job.
86
+ *Ruy Rocha*
1088
87
 
1089
- *Jean Boussier*
88
+ * Add support for SQLite3 full-text-search and other virtual tables.
1090
89
 
1091
- * Deprecate `config.active_record.warn_on_records_fetched_greater_than` now that `sql.active_record`
1092
- notification includes `:row_count` field.
90
+ Previously, adding sqlite3 virtual tables messed up `schema.rb`.
1093
91
 
1094
- *Jason Nochlin*
92
+ Now, virtual tables can safely be added using `create_virtual_table`.
1095
93
 
1096
- * Fix an issue with `where.associated` losing the current join type scope.
94
+ *Zacharias Knudsen*
1097
95
 
1098
- Example:
96
+ * Support use of alternative database interfaces via the `database_cli` ActiveRecord configuration option.
1099
97
 
1100
98
  ```ruby
1101
- Post.left_joins(:author).where.associated(:author)
99
+ Rails.application.configure do
100
+ config.active_record.database_cli = { postgresql: "pgcli" }
101
+ end
1102
102
  ```
1103
103
 
1104
- Previously, the `LEFT OUTER JOIN` would be lost and converted to an `INNER JOIN`.
104
+ *T S Vallender*
1105
105
 
1106
- *Saleh Alhaddad*
106
+ * Add support for dumping table inheritance and native partitioning table definitions for PostgeSQL adapter
1107
107
 
1108
- * Fix an issue where `ActiveRecord::Encryption` configurations are not ready before the loading
1109
- of Active Record models, when an application is eager loaded. As a result, encrypted attributes
1110
- could be misconfigured in some cases.
108
+ *Justin Talbott*
1111
109
 
1112
- *Maxime Réty*
110
+ * Add support for `ActiveRecord::Point` type casts using `Hash` values
1113
111
 
1114
- * Deprecate defining an `enum` with keyword arguments.
112
+ This allows `ActiveRecord::Point` to be cast or serialized from a hash
113
+ with `:x` and `:y` keys of numeric values, mirroring the functionality of
114
+ existing casts for string and array values. Both string and symbol keys are
115
+ supported.
1115
116
 
1116
117
  ```ruby
1117
- class Function > ApplicationRecord
1118
- # BAD
1119
- enum color: [:red, :blue],
1120
- type: [:instance, :class]
1121
-
1122
- # GOOD
1123
- enum :color, [:red, :blue]
1124
- enum :type, [:instance, :class]
118
+ class PostgresqlPoint < ActiveRecord::Base
119
+ attribute :x, :point
120
+ attribute :y, :point
121
+ attribute :z, :point
1125
122
  end
123
+
124
+ val = PostgresqlPoint.new({
125
+ x: '(12.34, -43.21)',
126
+ y: [12.34, '-43.21'],
127
+ z: {x: '12.34', y: -43.21}
128
+ })
129
+ ActiveRecord::Point.new(12.32, -43.21) == val.x == val.y == val.z
1126
130
  ```
1127
131
 
1128
- *Hartley McGuire*
132
+ *Stephen Drew*
1129
133
 
1130
- * Add `config.active_record.validate_migration_timestamps` option for validating migration timestamps.
134
+ * Replace `SQLite3::Database#busy_timeout` with `#busy_handler_timeout=`.
1131
135
 
1132
- When set, validates that the timestamp prefix for a migration is no more than a day ahead of
1133
- the timestamp associated with the current time. This is designed to prevent migrations prefixes
1134
- from being hand-edited to future timestamps, which impacts migration generation and other
1135
- migration commands.
136
+ Provides a non-GVL-blocking, fair retry interval busy handler implementation.
1136
137
 
1137
- *Adrianna Chang*
138
+ *Stephen Margheim*
1138
139
 
1139
- * Properly synchronize `Mysql2Adapter#active?` and `TrilogyAdapter#active?`.
140
+ * SQLite3Adapter: Translate `SQLite3::BusyException` into `ActiveRecord::StatementTimeout`.
1140
141
 
1141
- As well as `disconnect!` and `verify!`.
142
+ *Matthew Nguyen*
1142
143
 
1143
- This generally isn't a big problem as connections must not be shared between
1144
- threads, but is required when running transactional tests or system tests
1145
- and could lead to a SEGV.
144
+ * Include schema name in `enable_extension` statements in `db/schema.rb`.
1146
145
 
1147
- *Jean Boussier*
146
+ The schema dumper will now include the schema name in generated
147
+ `enable_extension` statements if they differ from the current schema.
1148
148
 
1149
- * Support `:source_location` tag option for query log tags.
149
+ For example, if you have a migration:
1150
150
 
1151
151
  ```ruby
1152
- config.active_record.query_log_tags << :source_location
152
+ enable_extension "heroku_ext.pgcrypto"
153
+ enable_extension "pg_stat_statements"
1153
154
  ```
1154
155
 
1155
- Calculating the caller location is a costly operation and should be used primarily in development
1156
- (note, there is also a `config.active_record.verbose_query_logs` that serves the same purpose)
1157
- or occasionally on production for debugging purposes.
1158
-
1159
- *fatkodima*
1160
-
1161
- * Add an option to `ActiveRecord::Encryption::Encryptor` to disable compression.
1162
-
1163
- Allow compression to be disabled by setting `compress: false`
156
+ then the generated schema dump will also contain:
1164
157
 
1165
158
  ```ruby
1166
- class User
1167
- encrypts :name, encryptor: ActiveRecord::Encryption::Encryptor.new(compress: false)
1168
- end
159
+ enable_extension "heroku_ext.pgcrypto"
160
+ enable_extension "pg_stat_statements"
1169
161
  ```
1170
162
 
1171
- *Donal McBreen*
1172
-
1173
- * Deprecate passing strings to `ActiveRecord::Tasks::DatabaseTasks.cache_dump_filename`.
1174
-
1175
- A `ActiveRecord::DatabaseConfigurations::DatabaseConfig` object should be passed instead.
1176
-
1177
- *Rafael Mendonça França*
1178
-
1179
- * Add `row_count` field to `sql.active_record` notification.
1180
-
1181
- This field returns the amount of rows returned by the query that emitted the notification.
1182
-
1183
- This metric is useful in cases where one wants to detect queries with big result sets.
1184
-
1185
- *Marvin Bitterlich*
1186
-
1187
- * Consistently raise an `ArgumentError` when passing an invalid argument to a nested attributes association writer.
1188
-
1189
- Previously, this would only raise on collection associations and produce a generic error on singular associations.
1190
-
1191
- Now, it will raise on both collection and singular associations.
1192
-
1193
- *Joshua Young*
1194
-
1195
- * Fix single quote escapes on default generated MySQL columns.
1196
-
1197
- MySQL 5.7.5+ supports generated columns, which can be used to create a column that is computed from an expression.
1198
-
1199
- Previously, the schema dump would output a string with double escapes for generated columns with single quotes in the default expression.
1200
-
1201
- This would result in issues when importing the schema on a fresh instance of a MySQL database.
1202
-
1203
- Now, the string will not be escaped and will be valid Ruby upon importing of the schema.
1204
-
1205
- *Yash Kapadia*
1206
-
1207
- * Fix Migrations with versions older than 7.1 validating options given to
1208
- `add_reference` and `t.references`.
1209
-
1210
- *Hartley McGuire*
1211
-
1212
- * Add `<role>_types` class method to `ActiveRecord::DelegatedType` so that the delegated types can be introspected.
1213
-
1214
- *JP Rosevear*
1215
-
1216
- * Make `schema_dump`, `query_cache`, `replica` and `database_tasks` configurable via `DATABASE_URL`.
1217
-
1218
- This wouldn't always work previously because boolean values would be interpreted as strings.
163
+ *Tony Novak*
1219
164
 
1220
- e.g. `DATABASE_URL=postgres://localhost/foo?schema_dump=false` now properly disable dumping the schema
1221
- cache.
1222
-
1223
- *Mike Coutermarsh*, *Jean Boussier*
165
+ * Fix `ActiveRecord::Encryption::EncryptedAttributeType#type` to return
166
+ actual cast type.
1224
167
 
1225
- * Introduce `ActiveRecord::Transactions::ClassMethods#set_callback`.
168
+ *Vasiliy Ermolovich*
1226
169
 
1227
- It is identical to `ActiveSupport::Callbacks::ClassMethods#set_callback`
1228
- but with support for `after_commit` and `after_rollback` callback options.
170
+ * SQLite3Adapter: Bulk insert fixtures.
1229
171
 
1230
- *Joshua Young*
172
+ Previously one insert command was executed for each fixture, now they are
173
+ aggregated in a single bulk insert command.
1231
174
 
1232
- * Make `ActiveRecord::Encryption::Encryptor` agnostic of the serialization format used for encrypted data.
175
+ *Lázaro Nixon*
1233
176
 
1234
- Previously, the encryptor instance only allowed an encrypted value serialized as a `String` to be passed to the message serializer.
177
+ * PostgreSQLAdapter: Allow `disable_extension` to be called with schema-qualified name.
1235
178
 
1236
- Now, the encryptor lets the configured `message_serializer` decide which types of serialized encrypted values are supported. A custom serialiser is therefore allowed to serialize `ActiveRecord::Encryption::Message` objects using a type other than `String`.
179
+ For parity with `enable_extension`, the `disable_extension` method can be called with a schema-qualified
180
+ name (e.g. `disable_extension "myschema.pgcrypto"`). Note that PostgreSQL's `DROP EXTENSION` does not
181
+ actually take a schema name (unlike `CREATE EXTENSION`), so the resulting SQL statement will only name
182
+ the extension, e.g. `DROP EXTENSION IF EXISTS "pgcrypto"`.
1237
183
 
1238
- The default `ActiveRecord::Encryption::MessageSerializer` already ensures that only `String` objects are passed for deserialization.
184
+ *Tony Novak*
1239
185
 
1240
- *Maxime Réty*
186
+ * Make `create_schema` / `drop_schema` reversible in migrations.
1241
187
 
1242
- * Fix `encrypted_attribute?` to take into account context properties passed to `encrypts`.
188
+ Previously, `create_schema` and `drop_schema` were irreversible migration operations.
1243
189
 
1244
- *Maxime Réty*
190
+ *Tony Novak*
1245
191
 
1246
- * The object returned by `explain` now responds to `pluck`, `first`,
1247
- `last`, `average`, `count`, `maximum`, `minimum`, and `sum`. Those
1248
- new methods run `EXPLAIN` on the corresponding queries:
192
+ * Support batching using custom columns.
1249
193
 
1250
194
  ```ruby
1251
- User.all.explain.count
1252
- # EXPLAIN SELECT COUNT(*) FROM `users`
1253
- # ...
1254
-
1255
- User.all.explain.maximum(:id)
1256
- # EXPLAIN SELECT MAX(`users`.`id`) FROM `users`
1257
- # ...
195
+ Product.in_batches(cursor: [:shop_id, :id]) do |relation|
196
+ # do something with relation
197
+ end
1258
198
  ```
1259
199
 
1260
- *Petrik de Heus*
1261
-
1262
- * Fixes an issue where `validates_associated` `:on` option wasn't respected
1263
- when validating associated records.
1264
-
1265
- *Austen Madden*, *Alex Ghiculescu*, *Rafał Brize*
1266
-
1267
- * Allow overriding SQLite defaults from `database.yml`.
200
+ *fatkodima*
1268
201
 
1269
- Any PRAGMA configuration set under the `pragmas` key in the configuration
1270
- file takes precedence over Rails' defaults, and additional PRAGMAs can be
1271
- set as well.
202
+ * Use SQLite `IMMEDIATE` transactions when possible.
1272
203
 
1273
- ```yaml
1274
- database: storage/development.sqlite3
1275
- timeout: 5000
1276
- pragmas:
1277
- journal_mode: off
1278
- temp_store: memory
1279
- ```
204
+ Transactions run against the SQLite3 adapter default to IMMEDIATE mode to improve concurrency support and avoid busy exceptions.
1280
205
 
1281
206
  *Stephen Margheim*
1282
207
 
1283
- * Remove warning message when running SQLite in production, but leave it unconfigured.
1284
-
1285
- There are valid use cases for running SQLite in production. However, it must be done
1286
- with care, so instead of a warning most users won't see anyway, it's preferable to
1287
- leave the configuration commented out to force them to think about having the database
1288
- on a persistent volume etc.
1289
-
1290
- *Jacopo Beschi*, *Jean Boussier*
208
+ * Raise specific exception when a connection is not defined.
1291
209
 
1292
- * Add support for generated columns to the SQLite3 adapter.
210
+ The new `ConnectionNotDefined` exception provides connection name, shard and role accessors indicating the details of the connection that was requested.
1293
211
 
1294
- Generated columns (both stored and dynamic) are supported since version 3.31.0 of SQLite.
1295
- This adds support for those to the SQLite3 adapter.
212
+ *Hana Harencarova*, *Matthew Draper*
1296
213
 
1297
- ```ruby
1298
- create_table :users do |t|
1299
- t.string :name
1300
- t.virtual :name_upper, type: :string, as: 'UPPER(name)'
1301
- t.virtual :name_lower, type: :string, as: 'LOWER(name)', stored: true
1302
- end
1303
- ```
1304
-
1305
- *Stephen Margheim*
214
+ * Delete the deprecated constant `ActiveRecord::ImmutableRelation`.
1306
215
 
1307
- * TrilogyAdapter: ignore `host` if `socket` parameter is set.
216
+ *Xavier Noria*
1308
217
 
1309
- This allows to configure a connection on a UNIX socket via `DATABASE_URL`:
218
+ * Fix duplicate callback execution when child autosaves parent with `has_one` and `belongs_to`.
1310
219
 
1311
- ```
1312
- DATABASE_URL=trilogy://does-not-matter/my_db_production?socket=/var/run/mysql.sock
1313
- ```
220
+ Before, persisting a new child record with a new associated parent record would run `before_validation`,
221
+ `after_validation`, `before_save` and `after_save` callbacks twice.
1314
222
 
1315
- *Jean Boussier*
223
+ Now, these callbacks are only executed once as expected.
1316
224
 
1317
- * Make `assert_queries_count`, `assert_no_queries`, `assert_queries_match`, and
1318
- `assert_no_queries_match` assertions public.
225
+ *Joshua Young*
1319
226
 
1320
- To assert the expected number of queries are made, Rails internally uses `assert_queries_count` and
1321
- `assert_no_queries`. To assert that specific SQL queries are made, `assert_queries_match` and
1322
- `assert_no_queries_match` are used. These assertions can now be used in applications as well.
227
+ * `ActiveRecord::Encryption::Encryptor` now supports a `:compressor` option to customize the compression algorithm used.
1323
228
 
1324
229
  ```ruby
1325
- class ArticleTest < ActiveSupport::TestCase
1326
- test "queries are made" do
1327
- assert_queries_count(1) { Article.first }
230
+ module ZstdCompressor
231
+ def self.deflate(data)
232
+ Zstd.compress(data)
1328
233
  end
1329
234
 
1330
- test "creates a foreign key" do
1331
- assert_queries_match(/ADD FOREIGN KEY/i, include_schema: true) do
1332
- @connection.add_foreign_key(:comments, :posts)
1333
- end
235
+ def self.inflate(data)
236
+ Zstd.decompress(data)
1334
237
  end
1335
238
  end
1336
- ```
1337
-
1338
- *Petrik de Heus*, *fatkodima*
1339
239
 
1340
- * Fix `has_secure_token` calls the setter method on initialize.
1341
-
1342
- *Abeid Ahmed*
240
+ class User
241
+ encrypts :name, compressor: ZstdCompressor
242
+ end
243
+ ```
1343
244
 
1344
- * When using a `DATABASE_URL`, allow for a configuration to map the protocol in the URL to a specific database
1345
- adapter. This allows decoupling the adapter the application chooses to use from the database connection details
1346
- set in the deployment environment.
245
+ You disable compression by passing `compress: false`.
1347
246
 
1348
247
  ```ruby
1349
- # ENV['DATABASE_URL'] = "mysql://localhost/example_database"
1350
- config.active_record.protocol_adapters.mysql = "trilogy"
1351
- # will connect to MySQL using the trilogy adapter
248
+ class User
249
+ encrypts :name, compress: false
250
+ end
1352
251
  ```
1353
252
 
1354
- *Jean Boussier*, *Kevin McPhillips*
253
+ *heka1024*
1355
254
 
1356
- * In cases where MySQL returns `warning_count` greater than zero, but returns no warnings when
1357
- the `SHOW WARNINGS` query is executed, `ActiveRecord.db_warnings_action` proc will still be
1358
- called with a generic warning message rather than silently ignoring the warning(s).
255
+ * Add condensed `#inspect` for `ConnectionPool`, `AbstractAdapter`, and
256
+ `DatabaseConfig`.
1359
257
 
1360
- *Kevin McPhillips*
258
+ *Hartley McGuire*
1361
259
 
1362
- * `DatabaseConfigurations#configs_for` accepts a symbol in the `name` parameter.
260
+ * Add `.shard_keys`, `.sharded?`, & `.connected_to_all_shards` methods.
1363
261
 
1364
- *Andrew Novoselac*
262
+ ```ruby
263
+ class ShardedBase < ActiveRecord::Base
264
+ self.abstract_class = true
1365
265
 
1366
- * Fix `where(field: values)` queries when `field` is a serialized attribute
1367
- (for example, when `field` uses `ActiveRecord::Base.serialize` or is a JSON
1368
- column).
266
+ connects_to shards: {
267
+ shard_one: { writing: :shard_one },
268
+ shard_two: { writing: :shard_two }
269
+ }
270
+ end
1369
271
 
1370
- *João Alves*
272
+ class ShardedModel < ShardedBase
273
+ end
1371
274
 
1372
- * Make the output of `ActiveRecord::Core#inspect` configurable.
275
+ ShardedModel.shard_keys => [:shard_one, :shard_two]
276
+ ShardedModel.sharded? => true
277
+ ShardedBase.connected_to_all_shards { ShardedModel.current_shard } => [:shard_one, :shard_two]
278
+ ```
1373
279
 
1374
- By default, calling `inspect` on a record will yield a formatted string including just the `id`.
280
+ *Nony Dutton*
1375
281
 
1376
- ```ruby
1377
- Post.first.inspect #=> "#<Post id: 1>"
1378
- ```
282
+ * Add a `filter` option to `in_order_of` to prioritize certain values in the sorting without filtering the results
283
+ by these values.
1379
284
 
1380
- The attributes to be included in the output of `inspect` can be configured with
1381
- `ActiveRecord::Core#attributes_for_inspect`.
285
+ *Igor Depolli*
1382
286
 
1383
- ```ruby
1384
- Post.attributes_for_inspect = [:id, :title]
1385
- Post.first.inspect #=> "#<Post id: 1, title: "Hello, World!">"
1386
- ```
287
+ * Fix an issue where the IDs reader method did not return expected results
288
+ for preloaded associations in models using composite primary keys.
1387
289
 
1388
- With `attributes_for_inspect` set to `:all`, `inspect` will list all the record's attributes.
290
+ *Jay Ang*
1389
291
 
1390
- ```ruby
1391
- Post.attributes_for_inspect = :all
1392
- Post.first.inspect #=> "#<Post id: 1, title: "Hello, World!", published_at: "2023-10-23 14:28:11 +0000">"
1393
- ```
292
+ * Allow to configure `strict_loading_mode` globally or within a model.
1394
293
 
1395
- In `development` and `test` mode, `attributes_for_inspect` will be set to `:all` by default.
294
+ Defaults to `:all`, can be changed to `:n_plus_one_only`.
1396
295
 
1397
- You can also call `full_inspect` to get an inspection with all the attributes.
296
+ *Garen Torikian*
1398
297
 
1399
- The attributes in `attribute_for_inspect` will also be used for `pretty_print`.
298
+ * Add `ActiveRecord::Relation#readonly?`.
1400
299
 
1401
- *Andrew Novoselac*
300
+ Reflects if the relation has been marked as readonly.
1402
301
 
1403
- * Don't mark attributes as changed when reassigned to `Float::INFINITY` or
1404
- `-Float::INFINITY`.
302
+ *Theodor Tonum*
1405
303
 
1406
- *Maicol Bentancor*
304
+ * Improve `ActiveRecord::Store` to raise a descriptive exception if the column is not either
305
+ structured (e.g., PostgreSQL +hstore+/+json+, or MySQL +json+) or declared serializable via
306
+ `ActiveRecord.store`.
1407
307
 
1408
- * Support the `RETURNING` clause for MariaDB.
308
+ Previously, a `NoMethodError` would be raised when the accessor was read or written:
1409
309
 
1410
- *fatkodima*, *Nikolay Kondratyev*
310
+ NoMethodError: undefined method `accessor' for an instance of ActiveRecord::Type::Text
1411
311
 
1412
- * The SQLite3 adapter now implements the `supports_deferrable_constraints?` contract.
312
+ Now, a descriptive `ConfigurationError` is raised:
1413
313
 
1414
- Allows foreign keys to be deferred by adding the `:deferrable` key to the `foreign_key` options.
314
+ ActiveRecord::ConfigurationError: the column 'metadata' has not been configured as a store.
315
+ Please make sure the column is declared serializable via 'ActiveRecord.store' or, if your
316
+ database supports it, use a structured column type like hstore or json.
1415
317
 
1416
- ```ruby
1417
- add_reference :person, :alias, foreign_key: { deferrable: :deferred }
1418
- add_reference :alias, :person, foreign_key: { deferrable: :deferred }
1419
- ```
318
+ *Mike Dalessio*
1420
319
 
1421
- *Stephen Margheim*
320
+ * Fix inference of association model on nested models with the same demodularized name.
1422
321
 
1423
- * Add the `set_constraints` helper to PostgreSQL connections.
322
+ E.g. with the following setup:
1424
323
 
1425
324
  ```ruby
1426
- Post.create!(user_id: -1) # => ActiveRecord::InvalidForeignKey
1427
-
1428
- Post.transaction do
1429
- Post.connection.set_constraints(:deferred)
1430
- p = Post.create!(user_id: -1)
1431
- u = User.create!
1432
- p.user = u
1433
- p.save!
325
+ class Nested::Post < ApplicationRecord
326
+ has_one :post, through: :other
1434
327
  end
1435
328
  ```
1436
329
 
1437
- *Cody Cutrer*
1438
-
1439
- * Include `ActiveModel::API` in `ActiveRecord::Base`.
1440
-
1441
- *Sean Doyle*
1442
-
1443
- * Ensure `#signed_id` outputs `url_safe` strings.
1444
-
1445
- *Jason Meller*
330
+ Before, `#post` would infer the model as `Nested::Post`, but now it correctly infers `Post`.
1446
331
 
1447
- * Add `nulls_last` and working `desc.nulls_first` for MySQL.
332
+ *Joshua Young*
1448
333
 
1449
- *Tristan Fellows*
334
+ * Add public method for checking if a table is ignored by the schema cache.
1450
335
 
1451
- * Allow for more complex hash arguments for `order` which mimics `where` in `ActiveRecord::Relation`.
336
+ Previously, an application would need to reimplement `ignored_table?` from the schema cache class to check if a table was set to be ignored. This adds a public method to support this and updates the schema cache to use that directly.
1452
337
 
1453
338
  ```ruby
1454
- Topic.includes(:posts).order(posts: { created_at: :desc })
339
+ ActiveRecord.schema_cache_ignored_tables = ["developers"]
340
+ ActiveRecord.schema_cache_ignored_table?("developers")
341
+ => true
1455
342
  ```
1456
343
 
1457
- *Myles Boone*
344
+ *Eileen M. Uchitelle*
1458
345
 
1459
- Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/activerecord/CHANGELOG.md) for previous changes.
346
+ Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activerecord/CHANGELOG.md) for previous changes.