2024-06-01 17:14:26 +08:00
* Optimize `Relation#exists?` when records are loaded and the relation has no conditions.
This can avoid queries in some cases.
*fatkodima*
2024-06-13 06:14:06 +08:00
* Add a `filter` option to `in_order_of` to prioritize certain values in the sorting without filtering the results
by these values.
*Igor Depolli*
2024-06-04 21:08:29 +08:00
* Fix an issue where the IDs reader method did not return expected results
for preloaded associations in models using composite primary keys.
*Jay Ang*
2024-03-18 00:38:38 +08:00
* Allow to configure `strict_loading_mode` globally or within a model.
Defaults to `:all` , can be changed to `:n_plus_one_only` .
*Garen Torikian*
2024-05-30 00:52:15 +08:00
* Add `ActiveRecord::Relation#readonly?` .
2024-03-21 19:23:21 +08:00
Reflects if the relation has been marked as readonly.
*Theodor Tonum*
2024-05-24 02:53:57 +08:00
* Improve `ActiveRecord::Store` to raise a descriptive exception if the column is not either
structured (e.g., PostgreSQL +hstore+/+json+, or MySQL +json+) or declared serializable via
`ActiveRecord.store` .
Previously, a `NoMethodError` would be raised when the accessor was read or written:
NoMethodError: undefined method `accessor' for an instance of ActiveRecord::Type::Text
Now, a descriptive `ConfigurationError` is raised:
ActiveRecord::ConfigurationError: the column 'metadata' has not been configured as a store.
Please make sure the column is declared serializable via 'ActiveRecord.store' or, if your
database supports it, use a structured column type like hstore or json.
*Mike Dalessio*
2024-05-03 11:25:57 +08:00
* Fix inference of association model on nested models with the same demodularized name.
E.g. with the following setup:
```ruby
class Nested::Post < ApplicationRecord
has_one :post, through: :other
end
```
Before, `#post` would infer the model as `Nested::Post` , but now it correctly infers `Post` .
*Joshua Young*
2024-05-22 02:37:13 +08:00
* Add public method for checking if a table is ignored by the schema cache.
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.
```ruby
ActiveRecord.schema_cache_ignored_tables = ["developers"]
2024-05-22 03:37:38 +08:00
ActiveRecord.schema_cache_ignored_table?("developers")
2024-05-22 02:37:13 +08:00
=> true
```
*Eileen M. Uchitelle*
2024-02-22 01:43:15 +08:00
2024-05-14 00:44:50 +08:00
Please check [7-2-stable ](https://github.com/rails/rails/blob/7-2-stable/activerecord/CHANGELOG.md ) for previous changes.