hmcts / et-pet-et1

Application for Applying To (an) Employment Tribunal
MIT License
9 stars 3 forks source link

Update dependency rails to v7.1.2 - autoclosed #1579

Closed renovate[bot] closed 12 months ago

renovate[bot] commented 1 year ago

Mend Renovate logo banner

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
rails (source, changelog) '7.0.7.1' -> '7.1.2' age adoption passing confidence

[!WARNING] Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

rails/rails (rails) ### [`v7.1.2`](https://togithub.com/rails/rails/releases/tag/v7.1.2): 7.1.2 [Compare Source](https://togithub.com/rails/rails/compare/v7.1.1...v7.1.2) #### Active Support - Fix `:expires_in` option for `RedisCacheStore#write_multi`. *fatkodima* - Fix deserialization of non-string "purpose" field in Message serializer *Jacopo Beschi* - Prevent global cache options being overwritten when setting dynamic options inside a `ActiveSupport::Cache::Store#fetch` block. *Yasha Krasnou* - Fix missing `require` resulting in `NoMethodError` when running `bin/rails secrets:show` or `bin/rails secrets:edit`. *Stephen Ierodiaconou* - Ensure `{down,up}case_first` returns non-frozen string. *Jonathan Hefner* - Fix `#to_fs(:human_size)` to correctly work with negative numbers. *Earlopain* - Fix `BroadcastLogger#dup` so that it duplicates the logger's `broadcasts`. *Andrew Novoselac* - Fix issue where `bootstrap.rb` overwrites the `level` of a `BroadcastLogger`'s `broadcasts`. *Andrew Novoselac* - Fix `ActiveSupport::Cache` to handle outdated Marshal payload from Rails 6.1 format. Active Support's Cache is supposed to treat a Marshal payload that can no longer be deserialized as a cache miss. It fail to do so for compressed payload in the Rails 6.1 legacy format. *Jean Boussier* - Fix `OrderedOptions#dig` for array indexes. *fatkodima* - Fix time travel helpers to work when nested using with separate classes. *fatkodima* - Fix `delete_matched` for file cache store to work with keys longer than the max filename size. *fatkodima* and *Jonathan Hefner* - Fix compatibility with the `semantic_logger` gem. The `semantic_logger` gem doesn't behave exactly like stdlib logger in that `SemanticLogger#level` returns a Symbol while stdlib `Logger#level` returns an Integer. This caused the various `LogSubscriber` classes in Rails to break when assigned a `SemanticLogger` instance. *Jean Boussier*, *ojab* #### Active Model - Make `==(other)` method of AttributeSet safe. *Dmitry Pogrebnoy* #### Active Record - Fix renaming primary key index when renaming a table with a UUID primary key in PostgreSQL. *fatkodima* - Fix `where(field: values)` queries when `field` is a serialized attribute (for example, when `field` uses `ActiveRecord::Base.serialize` or is a JSON column). *João Alves* - Prevent marking broken connections as verified. *Daniel Colson* - Don't mark Float::INFINITY as changed when reassigning it When saving a record with a float infinite value, it shouldn't mark as changed *Maicol Bentancor* - `ActiveRecord::Base.table_name` now returns `nil` instead of raising "undefined method `abstract_class?` for Object:Class". *a5-stable* - Fix upserting for custom `:on_duplicate` and `:unique_by` consisting of all inserts keys. *fatkodima* - Fixed an [issue](https://togithub.com/rails/rails/issues/49809) where saving a record could innappropriately `dup` its attributes. *Jonathan Hefner* - Dump schema only for a specific db for rollback/up/down tasks for multiple dbs. *fatkodima* - Fix `NoMethodError` when casting a PostgreSQL `money` value that uses a comma as its radix point and has no leading currency symbol. For example, when casting `"3,50"`. *Andreas Reischuck* and *Jonathan Hefner* - Re-enable support for using `enum` with non-column-backed attributes. Non-column-backed attributes must be previously declared with an explicit type. For example: ```ruby class Post < ActiveRecord::Base attribute :topic, :string enum topic: %i[science tech engineering math] end ``` *Jonathan Hefner* - Raise on `foreign_key:` being passed as an array in associations *Nikita Vasilevsky* - Return back maximum allowed PostgreSQL table name to 63 characters. *fatkodima* - Fix detecting `IDENTITY` columns for PostgreSQL < 10. *fatkodima* #### Action View - Fix the `number_to_human_size` view helper to correctly work with negative numbers. *Earlopain* - Automatically discard the implicit locals injected by collection rendering for template that can't accept them When rendering a collection, two implicit variables are injected, which breaks templates with strict locals. Now they are only passed if the template will actually accept them. *Yasha Krasnou*, *Jean Boussier* - Fix `@rails/ujs` calling `start()` an extra time when using bundlers *Hartley McGuire*, *Ryunosuke Sato* - Fix the `capture` view helper compatibility with HAML and Slim When a blank string was captured in HAML or Slim (and possibly other template engines) it would instead return the entire buffer. *Jean Boussier* #### Action Pack - Fix a race condition that could cause a `Text file busy - chromedriver` error with parallel system tests *Matt Brictson* - Fix `StrongParameters#extract_value` to include blank values Otherwise composite parameters may not be parsed correctly when one of the component is blank. *fatkodima*, *Yasha Krasnou*, *Matthias Eiglsperger* - Add `racc` as a dependency since it will become a bundled gem in Ruby 3.4.0 *Hartley McGuire* - Support handling Enumerator for non-buffered responses. *Zachary Scott* #### Active Job - No changes. #### Action Mailer - No changes. #### Action Cable - No changes. #### Active Storage - No changes. #### Action Mailbox - No changes. #### Action Text - Compile ESM package that can be used directly in the browser as actiontext.esm.js *Matias Grunberg* - Fix using actiontext.js with Sprockets *Matias Grunberg* - Upgrade Trix to 2.0.7 *Hartley McGuire* - Fix using Trix with Sprockets *Hartley McGuire* #### Railties - Fix running `db:system:change` when app has no Dockerfile. *Hartley McGuire* - If you accessed `config.eager_load_paths` and friends, later changes to `config.paths` were not reflected in the expected auto/eager load paths. Now, they are. This bug has been latent since Rails 3. Fixes [#​49629](https://togithub.com/rails/rails/issues/49629). *Xavier Noria* ### [`v7.1.1`](https://togithub.com/rails/rails/releases/tag/v7.1.1): 7.1.1 [Compare Source](https://togithub.com/rails/rails/compare/v7.1.0...v7.1.1) #### Active Support - Add support for keyword arguments when delegating calls to custom loggers from `ActiveSupport::BroadcastLogger`. *Jenny Shen* - `NumberHelper`: handle objects responding `to_d`. *fatkodima* - Fix RedisCacheStore to properly set the TTL when incrementing or decrementing. This bug was only impacting Redis server older than 7.0. *Thomas Countz* - Fix MemoryStore to prevent race conditions when incrementing or decrementing. *Pierre Jambet* #### Active Model - No changes. #### Active Record - Fix auto populating IDENTITY columns for PostgreSQL. *fatkodima* - Fix "ArgumentError: wrong number of arguments (given 3, expected 2)" when down migrating `rename_table` in older migrations. *fatkodima* - Do not require the Action Text, Active Storage and Action Mailbox tables to be present when running when running test on CI. *Rafael Mendonça França* #### Action View - Updated `@rails/ujs` files to ignore certain data-\* attributes when element is contenteditable. This fix was already landed in >= 7.0.4.3, < 7.1.0. \[[CVE-2023-23913](https://togithub.com/advisories/GHSA-xp5h-f8jf-rc8q)] *Ryunosuke Sato* #### Action Pack - No changes. #### Active Job - Don't log enqueuing details when the job wasn't enqueued. *Dustin Brown* #### Action Mailer - No changes. #### Action Cable - No changes. #### Active Storage - No changes. #### Action Mailbox - No changes. #### Action Text - No changes. #### Railties - Ensures the Rails generated Dockerfile uses correct ruby version and matches Gemfile. *Abhay Nikam* ### [`v7.1.0`](https://togithub.com/rails/rails/releases/tag/v7.1.0): 7.1.0 [Compare Source](https://togithub.com/rails/rails/compare/v7.0.8...v7.1.0) #### Active Support - Fix `AS::MessagePack` with `ENV["RAILS_MAX_THREADS"]`. *Jonathan Hefner* - Add a new public API for broadcasting logs This feature existed for a while but was until now a private API. Broadcasting log allows to send log message to difference sinks (STDOUT, a file ...) and is used by default in the development environment to write logs both on STDOUT and in the "development.log" file. Basic usage: ```ruby stdout_logger = Logger.new(STDOUT) file_logger = Logger.new("development.log") broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger, file_logger) broadcast.info("Hello!") # The "Hello!" message is written on STDOUT and in the log file. ``` Adding other sink(s) to the broadcast: ```ruby broadcast = ActiveSupport::BroadcastLogger.new broadcast.broadcast_to(Logger.new(STDERR)) ``` Remove a sink from the broadcast: ```ruby stdout_logger = Logger.new(STDOUT) broadcast = ActiveSupport::BroadcastLogger.new(stdout_logger) broadcast.stop_broadcasting_to(stdout_logger) ``` *Edouard Chin* - Fix Range#overlap? not taking empty ranges into account on Ruby < 3.3 *Nobuyoshi Nakada*, *Shouichi Kamiya*, *Hartley McGuire* - Use Ruby 3.3 Range#overlap? if available *Yasuo Honda* - Add `bigdecimal` as Active Support dependency that is a bundled gem candidate for Ruby 3.4. `bigdecimal` 3.1.4 or higher version will be installed. Ruby 2.7 and 3.0 users who want `bigdecimal` version 2.0.0 or 3.0.0 behavior as a default gem, pin the `bigdecimal` version in your application Gemfile. *Koichi ITO* - Add `drb`, `mutex_m` and `base64` that are bundled gem candidates for Ruby 3.4 *Yasuo Honda* - When using cache format version >= 7.1 or a custom serializer, expired and version-mismatched cache entries can now be detected without deserializing their values. *Jonathan Hefner* - Make all cache stores return a boolean for `#delete` Previously the `RedisCacheStore#delete` would return `1` if the entry exists and `0` otherwise. Now it returns true if the entry exists and false otherwise, just like the other stores. The `FileStore` would return `nil` if the entry doesn't exists and returns `false` now as well. *Petrik de Heus* - Active Support cache stores now support replacing the default compressor via a `:compressor` option. The specified compressor must respond to `deflate` and `inflate`. For example: ```ruby module MyCompressor def self.deflate(string) ``` ### compression logic... end def self.inflate(compressed) ### decompression logic... end end config.cache_store = :redis_cache_store, { compressor: MyCompressor } ``` *Jonathan Hefner* - Active Support cache stores now support a `:serializer` option. Similar to the `:coder` option, serializers must respond to `dump` and `load`. However, serializers are only responsible for serializing a cached value, whereas coders are responsible for serializing the entire `ActiveSupport::Cache::Entry` instance. Additionally, the output from serializers can be automatically compressed, whereas coders are responsible for their own compression. Specifying a serializer instead of a coder also enables performance optimizations, including the bare string optimization introduced by cache format version 7.1. The `:serializer` and `:coder` options are mutually exclusive. Specifying both will raise an `ArgumentError`. *Jonathan Hefner* - Fix `ActiveSupport::Inflector.humanize(nil)` raising ``NoMethodError: undefined method `end_with?' for nil:NilClass``. *James Robinson* - Don't show secrets for `ActiveSupport::KeyGenerator#inspect`. Before: ```ruby ActiveSupport::KeyGenerator.new(secret).inspect "#" ``` After: ```ruby ActiveSupport::KeyGenerator::Aes256Gcm(secret).inspect "#" ``` *Petrik de Heus* - Improve error message when EventedFileUpdateChecker is used without a compatible version of the Listen gem *Hartley McGuire* - Add `:report` behavior for Deprecation Setting `config.active_support.deprecation = :report` uses the error reporter to report deprecation warnings to `ActiveSupport::ErrorReporter`. Deprecations are reported as handled errors, with a severity of `:warning`. Useful to report deprecations happening in production to your bug tracker. *Étienne Barrié* - Rename `Range#overlaps?` to `#overlap?` and add alias for backwards compatibility *Christian Schmidt* - Fix `EncryptedConfiguration` returning incorrect values for some `Hash` methods *Hartley McGuire* - Don't show secrets for `MessageEncryptor#inspect`. Before: ```ruby ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect "#" ``` After: ```ruby ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect "#" ``` *Petrik de Heus* - Don't show contents for `EncryptedConfiguration#inspect`. Before: ```ruby Rails.application.credentials.inspect "#\"something secret\"} ... @​key_file_contents=\"915e4ea054e011022398dc242\" ...>" ``` After: ```ruby Rails.application.credentials.inspect "#" ``` *Petrik de Heus* - `ERB::Util.html_escape_once` always returns an `html_safe` string. This method previously maintained the `html_safe?` property of a string on the return value. Because this string has been escaped, however, not marking it as `html_safe` causes entities to be double-escaped. As an example, take this view snippet: ```html

<%= html_escape_once("this & that & the other") %>

``` Before this change, that would be double-escaped and render as: ```html

this &amp; that &amp; the other

``` After this change, it renders correctly as: ```html

this & that & the other

``` Fixes [#​48256](https://togithub.com/rails/rails/issues/48256) *Mike Dalessio* - Deprecate `SafeBuffer#clone_empty`. This method has not been used internally since Rails 4.2.0. *Mike Dalessio* - `MessageEncryptor`, `MessageVerifier`, and `config.active_support.message_serializer` now accept `:message_pack` and `:message_pack_allow_marshal` as serializers. These serializers require the [`msgpack` gem](https://rubygems.org/gems/msgpack) (>= 1.7.0). The Message Pack format can provide improved performance and smaller payload sizes. It also supports round-tripping some Ruby types that are not supported by JSON. For example: ```ruby verifier = ActiveSupport::MessageVerifier.new("secret") data = [{ a: 1 }, { b: 2 }.with_indifferent_access, 1.to_d, Time.at(0, 123)] message = verifier.generate(data) ``` ### BEFORE with config.active_support.message_serializer = :json verifier.verified(message) ### => \[{"a"=>1}, {"b"=>2}, "1.0", "1969-12-31T18:00:00.000-06:00"] verifier.verified(message).map(&:class) ### => \[Hash, Hash, String, String] ### AFTER with config.active_support.message_serializer = :message_pack verifier.verified(message) ### => \[{:a=>1}, {"b"=>2}, 0.1e1, 1969-12-31 18:00:00.000123 -0600] verifier.verified(message).map(&:class) ### => \[Hash, ActiveSupport::HashWithIndifferentAccess, BigDecimal, Time] ``` The `:message_pack` serializer can fall back to deserializing with `ActiveSupport::JSON` when necessary, and the `:message_pack_allow_marshal` serializer can fall back to deserializing with `Marshal` as well as `ActiveSupport::JSON`. Additionally, the `:marshal`, `:json`, and `:json_allow_marshal` serializers can now fall back to deserializing with `ActiveSupport::MessagePack` when necessary. These behaviors ensure old messages can still be read so that migration is easier. *Jonathan Hefner* - A new `7.1` cache format is available which includes an optimization for bare string values such as view fragments. The `7.1` cache format is used by default for new apps, and existing apps can enable the format by setting `config.load_defaults 7.1` or by setting `config.active_support.cache_format_version = 7.1` in `config/application.rb` or a `config/environments/*.rb` file. Cache entries written using the `6.1` or `7.0` cache formats can be read when using the `7.1` format. To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have not yet been upgraded must be able to read caches from upgraded servers, leave the cache format unchanged on the first deploy, then enable the `7.1` cache format on a subsequent deploy. *Jonathan Hefner* - Active Support cache stores can now use a preconfigured serializer based on `ActiveSupport::MessagePack` via the `:serializer` option: ```ruby config.cache_store = :redis_cache_store, { serializer: :message_pack } ``` The `:message_pack` serializer can reduce cache entry sizes and improve performance, but requires the [`msgpack` gem](https://rubygems.org/gems/msgpack) (>= 1.7.0). The `:message_pack` serializer can read cache entries written by the default serializer, and the default serializer can now read entries written by the `:message_pack` serializer. These behaviors make it easy to migrate between serializer without invalidating the entire cache. *Jonathan Hefner* - `Object#deep_dup` no longer duplicate named classes and modules. Before: ```ruby hash = { class: Object, module: Kernel } hash.deep_dup # => {:class=>#, :module=>#} ``` After: ```ruby hash = { class: Object, module: Kernel } hash.deep_dup # => {:class=>Object, :module=>Kernel} ``` *Jean Boussier* - Consistently raise an `ArgumentError` if the `ActiveSupport::Cache` key is blank. *Joshua Young* - Deprecate usage of the singleton `ActiveSupport::Deprecation`. All usage of `ActiveSupport::Deprecation` as a singleton is deprecated, the most common one being `ActiveSupport::Deprecation.warn`. Gem authors should now create their own deprecator (`ActiveSupport::Deprecation` object), and use it to emit deprecation warnings. Calling any of the following without specifying a deprecator argument is also deprecated: - Module.deprecate - deprecate_constant - DeprecatedObjectProxy - DeprecatedInstanceVariableProxy - DeprecatedConstantProxy - deprecation-related test assertions Use of `ActiveSupport::Deprecation.silence` and configuration methods like `behavior=`, `disallowed_behavior=`, `disallowed_warnings=` should now be aimed at the [application's deprecators](https://api.rubyonrails.org/classes/Rails/Application.html#method-i-deprecators). ```ruby Rails.application.deprecators.silence do ``` ### code that emits deprecation warnings end ``` If your gem has a Railtie or Engine, it's encouraged to add your deprecator to the application's deprecators, that way the deprecation related configuration options will apply to it as well, e.g. `config.active_support.report_deprecations` set to `false` in the production environment will also disable your deprecator. ```ruby initializer "my_gem.deprecator" do |app| app.deprecators[:my_gem] = MyGem.deprecator end ``` *Étienne Barrié* - Add `Object#with` to set and restore public attributes around a block ```ruby client.timeout # => 5 client.with(timeout: 1) do client.timeout # => 1 end client.timeout # => 5 ``` *Jean Boussier* - Remove deprecated support to generate incorrect RFC 4122 UUIDs when providing a namespace ID that is not one of the constants defined on `Digest::UUID`. *Rafael Mendonça França* - Deprecate `config.active_support.use_rfc4122_namespaced_uuids`. *Rafael Mendonça França* - Remove implicit conversion of objects into `String` by `ActiveSupport::SafeBuffer`. *Rafael Mendonça França* - Remove deprecated `active_support/core_ext/range/include_time_with_zone` file. *Rafael Mendonça França* - Deprecate `config.active_support.remove_deprecated_time_with_zone_name`. *Rafael Mendonça França* - Remove deprecated override of `ActiveSupport::TimeWithZone.name`. *Rafael Mendonça França* - Deprecate `config.active_support.disable_to_s_conversion`. *Rafael Mendonça França* - Remove deprecated option to passing a format to `#to_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`, `BigDecimal`, `Float` and, `Integer`. *Rafael Mendonça França* - Remove deprecated `ActiveSupport::PerThreadRegistry`. *Rafael Mendonça França* - Remove deprecated override of `Enumerable#sum`. *Rafael Mendonça França* - Deprecated initializing a `ActiveSupport::Cache::MemCacheStore` with an instance of `Dalli::Client`. Deprecate the undocumented option of providing an already-initialized instance of `Dalli::Client` to `ActiveSupport::Cache::MemCacheStore`. Such clients could be configured with unrecognized options, which could lead to unexpected behavior. Instead, provide addresses as documented. *aledustet* - Stub `Time.new()` in `TimeHelpers#travel_to` ```ruby travel_to Time.new(2004, 11, 24) do ``` ### Inside the `travel_to` block `Time.new` is stubbed assert_equal 2004, Time.new.year end ``` *fatkodima* - Raise `ActiveSupport::MessageEncryptor::InvalidMessage` from `ActiveSupport::MessageEncryptor#decrypt_and_verify` regardless of cipher. Previously, when a `MessageEncryptor` was using a non-AEAD cipher such as AES-256-CBC, a corrupt or tampered message would raise `ActiveSupport::MessageVerifier::InvalidSignature`. Now, all ciphers raise the same error: ```ruby encryptor = ActiveSupport::MessageEncryptor.new("x" * 32, cipher: "aes-256-gcm") message = encryptor.encrypt_and_sign("message") encryptor.decrypt_and_verify(message.next) ``` ### => raises ActiveSupport::MessageEncryptor::InvalidMessage encryptor = ActiveSupport::MessageEncryptor.new("x" * 32, cipher: "aes-256-cbc") message = encryptor.encrypt_and_sign("message") encryptor.decrypt_and_verify(message.next) ### BEFORE: ### => raises ActiveSupport::MessageVerifier::InvalidSignature ### AFTER: ### => raises ActiveSupport::MessageEncryptor::InvalidMessage ``` *Jonathan Hefner* - Support `nil` original values when using `ActiveSupport::MessageVerifier#verify`. Previously, `MessageVerifier#verify` did not work with `nil` original values, though both `MessageVerifier#verified` and `MessageEncryptor#decrypt_and_verify` do: ```ruby encryptor = ActiveSupport::MessageEncryptor.new(secret) message = encryptor.encrypt_and_sign(nil) encryptor.decrypt_and_verify(message) ``` ### => nil verifier = ActiveSupport::MessageVerifier.new(secret) message = verifier.generate(nil) verifier.verified(message) ### => nil verifier.verify(message) ### BEFORE: ### => raises ActiveSupport::MessageVerifier::InvalidSignature ### AFTER: ### => nil ``` *Jonathan Hefner* - Maintain `html_safe?` on html_safe strings when sliced with `slice`, `slice!`, or `chr` method. Previously, `html_safe?` was only maintained when the html_safe strings were sliced with `[]` method. Now, `slice`, `slice!`, and `chr` methods will maintain `html_safe?` like `[]` method. ```ruby string = "
test
".html_safe string.slice(0, 1).html_safe? # => true string.slice!(0, 1).html_safe? # => true ``` ### maintain html_safe? after the slice! string.html_safe? # => true string.chr.html_safe? # => true ``` *Michael Go* - Add `Object#in?` support for open ranges. ```ruby assert Date.today.in?(..Date.tomorrow) assert_not Date.today.in?(Date.tomorrow..) ``` *Ignacio Galindo* - `config.i18n.raise_on_missing_translations = true` now raises on any missing translation. Previously it would only raise when called in a view or controller. Now it will raise anytime `I18n.t` is provided an unrecognised key. If you do not want this behaviour, you can customise the i18n exception handler. See the upgrading guide or i18n guide for more information. *Alex Ghiculescu* - `ActiveSupport::CurrentAttributes` now raises if a restricted attribute name is used. Attributes such as `set` and `reset` cannot be used as they clash with the `CurrentAttributes` public API. *Alex Ghiculescu* - `HashWithIndifferentAccess#transform_keys` now takes a Hash argument, just as Ruby's `Hash#transform_keys` does. *Akira Matsuda* - `delegate` now defines method with proper arity when delegating to a Class. With this change, it defines faster method (3.5x faster with no argument). However, in order to gain this benefit, the delegation target method has to be defined before declaring the delegation. ```ruby ``` ### This defines 3.5 times faster method than before class C def self.x() end delegate :x, to: :class end class C ### This works but silently falls back to old behavior because ### `delegate` cannot find the definition of `x` delegate :x, to: :class def self.x() end end ``` *Akira Matsuda* - `assert_difference` message now includes what changed. This makes it easier to debug non-obvious failures. Before: "User.count" didn't change by 32. Expected: 1611 Actual: 1579 After: "User.count" didn't change by 32, but by 0. Expected: 1611 Actual: 1579 *Alex Ghiculescu* - Add ability to match exception messages to `assert_raises` assertion Instead of this ```ruby error = assert_raises(ArgumentError) do perform_service(param: 'exception') end assert_match(/incorrect param/i, error.message) ``` you can now write this ```ruby assert_raises(ArgumentError, match: /incorrect param/i) do perform_service(param: 'exception') end ``` *fatkodima* - Add `Rails.env.local?` shorthand for `Rails.env.development? || Rails.env.test?`. *DHH* - `ActiveSupport::Testing::TimeHelpers` now accepts named `with_usec` argument to `freeze_time`, `travel`, and `travel_to` methods. Passing true prevents truncating the destination time with `change(usec: 0)`. *KevSlashNull*, and *serprex* - `ActiveSupport::CurrentAttributes.resets` now accepts a method name The block API is still the recommended approach, but now both APIs are supported: ```ruby class Current < ActiveSupport::CurrentAttributes resets { Time.zone = nil } resets :clear_time_zone end ``` *Alex Ghiculescu* - Ensure `ActiveSupport::Testing::Isolation::Forking` closes pipes Previously, `Forking.run_in_isolation` opened two ends of a pipe. The fork process closed the read end, wrote to it, and then terminated (which presumably closed the file descriptors on its end). The parent process closed the write end, read from it, and returned, never closing the read end. This resulted in an accumulation of open file descriptors, which could cause errors if the limit is reached. *Sam Bostock* - Fix `Time#change` and `Time#advance` for times around the end of Daylight Saving Time. Previously, when `Time#change` or `Time#advance` constructed a time inside the final stretch of Daylight Saving Time (DST), the non-DST offset would always be chosen for local times: ```ruby ``` ### DST ended just before 2021-11-07 2:00:00 AM in US/Eastern. ENV["TZ"] = "US/Eastern" time = Time.local(2021, 11, 07, 00, 59, 59) + 1 ### => 2021-11-07 01:00:00 -0400 time.change(day: 07) ### => 2021-11-07 01:00:00 -0500 time.advance(seconds: 0) ### => 2021-11-07 01:00:00 -0500 time = Time.local(2021, 11, 06, 01, 00, 00) ### => 2021-11-06 01:00:00 -0400 time.change(day: 07) ### => 2021-11-07 01:00:00 -0500 time.advance(days: 1) ### => 2021-11-07 01:00:00 -0500 ``` And the DST offset would always be chosen for times with a `TimeZone` object: ```ruby Time.zone = "US/Eastern" time = Time.new(2021, 11, 07, 02, 00, 00, Time.zone) - 3600 ### => 2021-11-07 01:00:00 -0500 time.change(day: 07) ### => 2021-11-07 01:00:00 -0400 time.advance(seconds: 0) ### => 2021-11-07 01:00:00 -0400 time = Time.new(2021, 11, 8, 01, 00, 00, Time.zone) ### => 2021-11-08 01:00:00 -0500 time.change(day: 07) ### => 2021-11-07 01:00:00 -0400 time.advance(days: -1) ### => 2021-11-07 01:00:00 -0400 ``` Now, `Time#change` and `Time#advance` will choose the offset that matches the original time's offset when possible: ```ruby ENV["TZ"] = "US/Eastern" time = Time.local(2021, 11, 07, 00, 59, 59) + 1 ### => 2021-11-07 01:00:00 -0400 time.change(day: 07) ### => 2021-11-07 01:00:00 -0400 time.advance(seconds: 0) ### => 2021-11-07 01:00:00 -0400 time = Time.local(2021, 11, 06, 01, 00, 00) ### => 2021-11-06 01:00:00 -0400 time.change(day: 07) ### => 2021-11-07 01:00:00 -0400 time.advance(days: 1) ### => 2021-11-07 01:00:00 -0400 Time.zone = "US/Eastern" time = Time.new(2021, 11, 07, 02, 00, 00, Time.zone) - 3600 ### => 2021-11-07 01:00:00 -0500 time.change(day: 07) ### => 2021-11-07 01:00:00 -0500 time.advance(seconds: 0) ### => 2021-11-07 01:00:00 -0500 time = Time.new(2021, 11, 8, 01, 00, 00, Time.zone) ### => 2021-11-08 01:00:00 -0500 time.change(day: 07) ### => 2021-11-07 01:00:00 -0500 time.advance(days: -1) ### => 2021-11-07 01:00:00 -0500 ``` *Kevin Hall*, *Takayoshi Nishida*, and *Jonathan Hefner* - Fix MemoryStore to preserve entries TTL when incrementing or decrementing This is to be more consistent with how MemCachedStore and RedisCacheStore behaves. *Jean Boussier* - `Rails.error.handle` and `Rails.error.record` filter now by multiple error classes. ```ruby Rails.error.handle(IOError, ArgumentError) do 1 + '1' # raises TypeError end 1 + 1 # TypeErrors are not IOErrors or ArgumentError, so this will *not* be handled ``` *Martin Spickermann* - `Class#subclasses` and `Class#descendants` now automatically filter reloaded classes. Previously they could return old implementations of reloadable classes that have been dereferenced but not yet garbage collected. They now automatically filter such classes like `DescendantTracker#subclasses` and `DescendantTracker#descendants`. *Jean Boussier* - `Rails.error.report` now marks errors as reported to avoid reporting them twice. In some cases, users might want to report errors explicitly with some extra context before letting it bubble up. This also allows to safely catch and report errors outside of the execution context. *Jean Boussier* - Add `assert_error_reported` and `assert_no_error_reported` Allows to easily asserts an error happened but was handled ```ruby report = assert_error_reported(IOError) do ``` ### ... end assert_equal "Oops", report.error.message assert_equal "admin", report.context[:section] assert_equal :warning, report.severity assert_predicate report, :handled? ``` *Jean Boussier* - `ActiveSupport::Deprecation` behavior callbacks can now receive the deprecator instance as an argument. This makes it easier for such callbacks to change their behavior based on the deprecator's state. For example, based on the deprecator's `debug` flag. 3-arity and splat-args callbacks such as the following will now be passed the deprecator instance as their third argument: - `->(message, callstack, deprecator) { ... }` - `->(*args) { ... }` - `->(message, *other_args) { ... }` 2-arity and 4-arity callbacks such as the following will continue to behave the same as before: - `->(message, callstack) { ... }` - `->(message, callstack, deprecation_horizon, gem_name) { ... }` - `->(message, callstack, *deprecation_details) { ... }` *Jonathan Hefner* - `ActiveSupport::Deprecation#disallowed_warnings` now affects the instance on which it is configured. This means that individual `ActiveSupport::Deprecation` instances can be configured with their own disallowed warnings, and the global `ActiveSupport::Deprecation.disallowed_warnings` now only affects the global `ActiveSupport::Deprecation.warn`. **Before** ```ruby ActiveSupport::Deprecation.disallowed_warnings = ["foo"] deprecator = ActiveSupport::Deprecation.new("2.0", "MyCoolGem") deprecator.disallowed_warnings = ["bar"] ActiveSupport::Deprecation.warn("foo") # => raise ActiveSupport::DeprecationException ActiveSupport::Deprecation.warn("bar") # => print "DEPRECATION WARNING: bar" deprecator.warn("foo") # => raise ActiveSupport::DeprecationException deprecator.warn("bar") # => print "DEPRECATION WARNING: bar" ``` **After** ```ruby ActiveSupport::Deprecation.disallowed_warnings = ["foo"] deprecator = ActiveSupport::Deprecation.new("2.0", "MyCoolGem") deprecator.disallowed_warnings = ["bar"] ActiveSupport::Deprecation.warn("foo") # => raise ActiveSupport::DeprecationException ActiveSupport::Deprecation.warn("bar") # => print "DEPRECATION WARNING: bar" deprecator.warn("foo") # => print "DEPRECATION WARNING: foo" deprecator.warn("bar") # => raise ActiveSupport::DeprecationException ``` Note that global `ActiveSupport::Deprecation` methods such as `ActiveSupport::Deprecation.warn` and `ActiveSupport::Deprecation.disallowed_warnings` have been deprecated. *Jonathan Hefner* - Add italic and underline support to `ActiveSupport::LogSubscriber#color` Previously, only bold text was supported via a positional argument. This allows for bold, italic, and underline options to be specified for colored logs. ```ruby info color("Hello world!", :red, bold: true, underline: true) ``` *Gannon McGibbon* - Add `String#downcase_first` method. This method is the corollary of `String#upcase_first`. *Mark Schneider* - `thread_mattr_accessor` will call `.dup.freeze` on non-frozen default values. This provides a basic level of protection against different threads trying to mutate a shared default object. *Jonathan Hefner* - Add `raise_on_invalid_cache_expiration_time` config to `ActiveSupport::Cache::Store` Specifies if an `ArgumentError` should be raised if `Rails.cache` `fetch` or `write` are given an invalid `expires_at` or `expires_in` time. Options are `true`, and `false`. If `false`, the exception will be reported as `handled` and logged instead. Defaults to `true` if `config.load_defaults >= 7.1`. *Trevor Turk* - `ActiveSupport::Cache:Store#fetch` now passes an options accessor to the block. It makes possible to override cache options: Rails.cache.fetch("3rd-party-token") do |name, options| token = fetch_token_from_remote ### set cache's TTL to match token's TTL options.expires_in = token.expires_in token end *Andrii Gladkyi*, *Jean Boussier* - `default` option of `thread_mattr_accessor` now applies through inheritance and also across new threads. Previously, the `default` value provided was set only at the moment of defining the attribute writer, which would cause the attribute to be uninitialized in descendants and in other threads. Fixes [#​43312](https://togithub.com/rails/rails/issues/43312). *Thierry Deo* - Redis cache store is now compatible with redis-rb 5.0. *Jean Boussier* - Add `skip_nil:` support to `ActiveSupport::Cache::Store#fetch_multi`. *Daniel Alfaro* - Add `quarter` method to date/time *Matt Swanson* - Fix `NoMethodError` on custom `ActiveSupport::Deprecation` behavior. `ActiveSupport::Deprecation.behavior=` was supposed to accept any object that responds to `call`, but in fact its internal implementation assumed that this object could respond to `arity`, so it was restricted to only `Proc` objects. This change removes this `arity` restriction of custom behaviors. *Ryo Nakamura* - Support `:url_safe` option for `MessageEncryptor`. The `MessageEncryptor` constructor now accepts a `:url_safe` option, similar to the `MessageVerifier` constructor. When enabled, this option ensures that messages use a URL-safe encoding. *Jonathan Hefner* - Add `url_safe` option to `ActiveSupport::MessageVerifier` initializer `ActiveSupport::MessageVerifier.new` now takes optional `url_safe` argument. It can generate URL-safe strings by passing `url_safe: true`. ```ruby verifier = ActiveSupport::MessageVerifier.new(url_safe: true) message = verifier.generate(data) # => URL-safe string ``` This option is `false` by default to be backwards compatible. *Shouichi Kamiya* - Enable connection pooling by default for `MemCacheStore` and `RedisCacheStore`. If you want to disable connection pooling, set `:pool` option to `false` when configuring the cache store: ```ruby config.cache_store = :mem_cache_store, "cache.example.com", pool: false ``` *fatkodima* - Add `force:` support to `ActiveSupport::Cache::Store#fetch_multi`. *fatkodima* - Deprecated `:pool_size` and `:pool_timeout` options for configuring connection pooling in cache stores. Use `pool: true` to enable pooling with default settings: ```ruby config.cache_store = :redis_cache_store, pool: true ``` Or pass individual options via `:pool` option: ```ruby config.cache_store = :redis_cache_store, pool: { size: 10, timeout: 2 } ``` *fatkodima* - Allow #increment and #decrement methods of `ActiveSupport::Cache::Store` subclasses to set new values. Previously incrementing or decrementing an unset key would fail and return nil. A default will now be assumed and the key will be created. *Andrej Blagojević*, *Eugene Kenny* - Add `skip_nil:` support to `RedisCacheStore` *Joey Paris* - `ActiveSupport::Cache::MemoryStore#write(name, val, unless_exist:true)` now correctly writes expired keys. *Alan Savage* - `ActiveSupport::ErrorReporter` now accepts and forward a `source:` parameter. This allow libraries to signal the origin of the errors, and reporters to easily ignore some sources. *Jean Boussier* - Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`. Add the method `ERB::Util.xml_name_escape` to escape dangerous characters in names of tags and names of attributes, following the specification of XML. *Álvaro Martín Fraguas* - Respect `ActiveSupport::Logger.new`'s `:formatter` keyword argument The stdlib `Logger::new` allows passing a `:formatter` keyword argument to set the logger's formatter. Previously `ActiveSupport::Logger.new` ignored that argument by always setting the formatter to an instance of `ActiveSupport::Logger::SimpleFormatter`. *Steven Harman* - Deprecate preserving the pre-Ruby 2.4 behavior of `to_time` With Ruby 2.4+ the default for +to_time+ changed from converting to the local system time to preserving the offset of the receiver. At the time Rails supported older versions of Ruby so a compatibility layer was added to assist in the migration process. From Rails 5.0 new applications have defaulted to the Ruby 2.4+ behavior and since Rails 7.0 now only supports Ruby 2.7+ this compatibility layer can be safely removed. To minimize any noise generated the deprecation warning only appears when the setting is configured to `false` as that is the only scenario where the removal of the compatibility layer has any effect. *Andrew White* - `Pathname.blank?` only returns true for `Pathname.new("")` Previously it would end up calling `Pathname#empty?` which returned true if the path existed and was an empty directory or file. That behavior was unlikely to be expected. *Jean Boussier* - Deprecate `Notification::Event`'s `#children` and `#parent_of?` *John Hawthorn* - Change the default serializer of `ActiveSupport::MessageVerifier` from `Marshal` to `ActiveSupport::JSON` when using `config.load_defaults 7.1`. Messages serialized with `Marshal` can still be read, but new messages will be serialized with `ActiveSupport::JSON`. For more information, see https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer. *Saba Kiaei*, *David Buckley*, and *Jonathan Hefner* - Change the default serializer of `ActiveSupport::MessageEncryptor` from `Marshal` to `ActiveSupport::JSON` when using `config.load_defaults 7.1`. Messages serialized with `Marshal` can still be read, but new messages will be serialized with `ActiveSupport::JSON`. For more information, see https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer. *Zack Deveau*, *Martin Gingras*, and *Jonathan Hefner* - Add `ActiveSupport::TestCase#stub_const` to stub a constant for the duration of a yield. *DHH* - Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4 *Stephen Sugden* - Improve `File.atomic_write` error handling *Daniel Pepper* - Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1. [The native `Class#descendants` was reverted prior to Ruby 3.1 release](https://bugs.ruby-lang.org/issues/14394#note-33), but `Class#subclasses` was kept, breaking the feature detection. *Jean Boussier* #### Active Model - Remove change in the typography of user facing error messages. For example, “can’t be blank” is again “can't be blank”. *Rafael Mendonça França* - Support composite identifiers in `to_key` `to_key` avoids wrapping `#id` value into an `Array` if `#id` already an array *Nikita Vasilevsky* - Add `ActiveModel::Conversion.param_delimiter` to configure delimiter being used in `to_param` *Nikita Vasilevsky* - `undefine_attribute_methods` undefines alias attribute methods along with attribute methods. *Nikita Vasilevsky* - Error.full_message now strips ":base" from the message. *zzak* - Add a load hook for `ActiveModel::Model` (named `active_model`) to match the load hook for `ActiveRecord::Base` and allow for overriding aspects of the `ActiveModel::Model` class. *Lewis Buckley* - Improve password length validation in ActiveModel::SecurePassword to consider byte size for BCrypt compatibility. The previous password length validation only considered the character count, which may not accurately reflect the 72-byte size limit imposed by BCrypt. This change updates the validation to consider both character count and byte size while keeping the character length validation in place. ```ruby user = User.new(password: "a" * 73) # 73 characters user.valid? # => false user.errors[:password] # => ["is too long"] user = User.new(password: "あ" * 25) # 25 characters, 75 bytes user.valid? # => false user.errors[:password] # => ["is too long"] ``` *ChatGPT*, *Guillermo Iguaran* - `has_secure_password` now generates an `#{attribute}_salt` method that returns the salt used to compute the password digest. The salt will change whenever the password is changed, so it can be used to create single-use password reset tokens with `generates_token_for`: ```ruby class User < ActiveRecord::Base has_secure_password generates_token_for :password_reset, expires_in: 15.minutes do password_salt&.last(10) end end ``` *Lázaro Nixon* - Improve typography of user facing error messages. In English contractions, the Unicode APOSTROPHE (`U+0027`) is now RIGHT SINGLE QUOTATION MARK (`U+2019`). For example, "can't be blank" is now "can’t be blank". *Jon Dufresne* - Add class to `ActiveModel::MissingAttributeError` error message. Show which class is missing the attribute in the error message: ```ruby user = User.first user.pets.select(:id).first.user_id ``` ### => ActiveModel::MissingAttributeError: missing attribute 'user_id' for Pet ``` *Petrik de Heus* - Raise `NoMethodError` in `ActiveModel::Type::Value#as_json` to avoid unpredictable results. *Vasiliy Ermolovich* - Custom attribute types that inherit from Active Model built-in types and do not override the `serialize` method will now benefit from an optimization when serializing attribute values for the database. For example, with a custom type like the following: ```ruby class DowncasedString < ActiveModel::Type::String def cast(value) super&.downcase end end ActiveRecord::Type.register(:downcased_string, DowncasedString) class User < ActiveRecord::Base attribute :email, :downcased_string end user = User.new(email: "FooBar@example.com") ``` Serializing the `email` attribute for the database will be roughly twice as fast. More expensive `cast` operations will likely see greater improvements. *Jonathan Hefner* - `has_secure_password` now supports password challenges via a `password_challenge` accessor and validation. A password challenge is a safeguard to verify that the current user is actually the password owner. It can be used when changing sensitive model fields, such as the password itself. It is different than a password confirmation, which is used to prevent password typos. When `password_challenge` is set, the validation checks that the value's digest matches the *currently persisted* `password_digest` (i.e. `password_digest_was`). This allows a password challenge to be done as part of a typical `update` call, just like a password confirmation. It also allows a password challenge error to be handled in the same way as other validation errors. For example, in the controller, instead of: ```ruby password_params = params.require(:password).permit( :password_challenge, :password, :password_confirmation, ) password_challenge = password_params.delete(:password_challenge) @​password_challenge_failed = !current_user.authenticate(password_challenge) if !@​password_challenge_failed && current_user.update(password_params) ``` ### ... end ``` You can now write: ```ruby password_params = params.require(:password).permit( :password_challenge, :password, :password_confirmation, ).with_defaults(password_challenge: "") if current_user.update(password_params) ### ... end ``` And, in the view, instead of checking `@password_challenge_failed`, you can render an error for the `password_challenge` field just as you would for other form fields, including utilizing `config.action_view.field_error_proc`. *Jonathan Hefner* - Support infinite ranges for `LengthValidator`s `:in`/`:within` options ```ruby validates_length_of :first_name, in: ..30 ``` *fatkodima* - Add support for beginless ranges to inclusivity/exclusivity validators: ```ruby validates_inclusion_of :birth_date, in: -> { (..Date.today) } ``` ```ruby validates_exclusion_of :birth_date, in: -> { (..Date.today) } ``` *Bo Jeanes* - Make validators accept lambdas without record argument ```ruby ``` ### Before validates_comparison_of :birth_date, less_than_or_equal_to: ->(_record) { Date.today } ### After validates_comparison_of :birth_date, less_than_or_equal_to: -> { Date.today } ``` *fatkodima* - Fix casting long strings to `Date`, `Time` or `DateTime` *fatkodima* - Use different cache namespace for proxy calls Models can currently have different attribute bodies for the same method names, leading to conflicts. Adding a new namespace `:active_model_proxy` fixes the issue. *Chris Salzberg* #### Active Record - Remove -shm and -wal SQLite files when `rails db:drop` is run. *Niklas Häusele* - Revert the change to raise an `ArgumentError` when `#accepts_nested_attributes_for` is declared more than once for an association in the same class. The reverted behavior broke the case where the `#accepts_nested_attributes_for` was defined in a concern and where overridden in the class that included the concern. *Rafael Mendonça França* - Better naming for unique constraints support. Naming unique keys leads to misunderstanding it's a short-hand of unique indexes. Just naming it unique constraints is not misleading. In Rails 7.1.0.beta1 or before: ```ruby add_unique_key :sections, [:position], deferrable: :deferred, name: "unique_section_position" remove_unique_key :sections, name: "unique_section_position" ``` Now: ```ruby add_unique_constraint :sections, [:position], deferrable: :deferred, name: "unique_section_position" remove_unique_constraint :sections, name: "unique_section_position" ``` *Ryuta Kamizono* - Fix duplicate quoting for check constraint expressions in schema dump when using MySQL A check constraint with an expression, that already contains quotes, lead to an invalid schema dump with the mysql2 adapter. Fixes [#​42424](https://togithub.com/rails/rails/issues/42424). *Felix Tscheulin* - Performance tune the SQLite3 adapter connection configuration For Rails applications, the Write-Ahead-Log in normal syncing mode with a capped journal size, a healthy shared memory buffer and a shared cache will perform, on average, 2× better. *Stephen Margheim* - Allow SQLite3 `busy_handler` to be configured with simple max number of `retries` Retrying busy connections without delay is a preferred practice for performance-sensitive applications. Add support for a `database.yml` `retries` integer, which is used in a simple `busy_handler` function to retry busy connections without exponential backoff up to the max number of `retries`. *Stephen Margheim* - The SQLite3 adapter now supports `supports_insert_returning?` Implementing the full `supports_insert_returning?` contract means the SQLite3 adapter supports auto-populated columns ([#​48241](https://togithub.com/rails/rails/issues/48241)) as well as custom primary keys. *Stephen Margheim* - Ensure the SQLite3 adapter handles default functions with the `||` concatenation operator Previously, this default function would produce the static string `"'Ruby ' || 'on ' || 'Rails'"`. Now, the adapter will appropriately receive and use `"Ruby on Rails"`. ```ruby change_column_default "test_models", "ruby_on_rails", -> { "('Ruby ' || 'on ' || 'Rails')" } ``` *Stephen Margheim* - Dump PostgreSQL schemas as part of the schema dump. *Lachlan Sylvester* - Encryption now supports `support_unencrypted_data` being set per-attribute. You can now opt out of `support_unencrypted_data` on a specific encrypted attribute. This only has an effect if `ActiveRecord::Encryption.config.support_unencrypted_data == true`. ```ruby class User < ActiveRecord::Base encrypts :name, deterministic: true, support_unencrypted_data: false encrypts :email, deterministic: true end ``` *Alex Ghiculescu* - Add instrumentation for Active Record transactions Allows subscribing to transaction events for tracking/instrumentation. The event payload contains the connection and the outcome (commit, rollback, restart, incomplete), as well as timing details. ```ruby ActiveSupport::Notifications.subscribe("transaction.active_record") do |event| puts "Transaction event occurred!" connection = event.payload[:connection] puts "Connection: #{connection.inspect}" end ``` *Daniel Colson*, *Ian Candy* - Support composite foreign keys via migration helpers. ```ruby ``` ### Assuming "carts" table has "(shop_id, user_id)" as a primary key. add_foreign_key(:orders, :carts, primary_key: [:shop_id, :user_id]) remove_foreign_key(:orders, :carts, primary_key: [:shop_id, :user_id]) foreign_key_exists?(:orders, :carts, primary_key: [:shop_id, :user_id]) ``` *fatkodima* - Adds support for `if_not_exists` when adding a check constraint. ```ruby add_check_constraint :posts, "post_type IN ('blog', 'comment', 'share')", if_not_exists: true ``` *Cody Cutrer* - Raise an `ArgumentError` when `#accepts_nested_attributes_for` is declared more than once for an association in the same class. Previously, the last declaration would silently override the previous one. Overriding in a subclass is still allowed. *Joshua Young* - Deprecate `rewhere` argument on `#merge`. The `rewhere` argument on `#merge`is deprecated without replacement and will be removed in Rails 7.2. *Adam Hess* - Fix unscope is not working in specific case Before: ```ruby Post.where(id: 1...3).unscope(where: :id).to_sql # "SELECT `posts`.* FROM `posts` WHERE `posts`.`id` >= 1 AND `posts`.`id` < 3" ``` After: ```ruby Post.where(id: 1...3).unscope(where: :id).to_sql # "SELECT `posts`.* FROM `posts`" ``` Fixes [#​48094](https://togithub.com/rails/rails/issues/48094). *Kazuya Hatanaka* - Change `has_secure_token` default to `on: :initialize` Change the new default value from `on: :create` to `on: :initialize` Can be controlled by the `config.active_record.generate_secure_token_on` configuration: ```ruby config.active_record.generate_secure_token_on = :create ``` *Sean Doyle* - Fix `change_column` not setting `precision: 6` on `datetime` columns when using 7.0+ Migrations and SQLite. *Hartley McGuire* - Support composite identifiers in `to_key` `to_key` avoids wrapping `#id` value into an `Array` if `#id` already an array *Nikita Vasilevsky* - Add validation option for `enum` ```ruby class Contract < ApplicationRecord enum :status, %w[in_progress completed], validate: true end Contract.new(status: "unknown").valid? # => false Contract.new(status: nil).valid? # => false Contract.new(status: "completed").valid? # => true class Contract < ApplicationRecord enum :status, %w[in_progress completed], validate: { allow_nil: true } end Contract.new(status: "unknown").valid? # => false Contract.new(status: nil).valid? # => true Contract.new(status: "completed").valid? # => true ``` *Edem Topuzov*, *Ryuta Kamizono* - Allow batching methods to use already loaded relation if available Calling batch methods on already loaded relations will use the records previously loaded instead of retrieving them from the database again. *Adam Hess* - Deprecate `read_attribute(:id)` returning the primary key if the primary key is not `:id`. Starting in Rails 7.2, `read_attribute(:id)` will return the value of the id column, regardless of the model's primary key. To retrieve the value of the primary key, use `#id` instead. `read_attribute(:id)` for composite primary key models will now return the value of the id column. *Adrianna Chang* - Fix `change_table` setting datetime precision for 6.1 Migrations *Hartley McGuire* - Fix change_column setting datetime precision for 6.1 Migrations *Hartley McGuire* - Add `ActiveRecord::Base#id_value` alias to access the raw value of a record's id column. This alias is only provided for models that declare an `:id` column. *Adrianna Chang* - Fix previous change tracking for `ActiveRecord::Store` when using a column with JSON structured database type Before, the methods to access the changes made during the last save `#saved_change_to_key?`, `#saved_change_to_key`, and `#key_before_last_save` did not work if the store was

Configuration

📅 Schedule: Branch creation - "after 7am and before 11am every weekday" in timezone Europe/London, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.



This PR has been generated by Mend Renovate. View repository job log here.

renovate[bot] commented 1 year ago

⚠ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

The artifact failure details are included below:

File name: Gemfile.lock
installing v2 tool ruby v3.2.2
[00:27:57.043] INFO (9): Installing tool ruby v3.2.2...
linking tool ruby v3.2.2
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
gem 3.4.10
RubyGems Environment:
  - RUBYGEMS VERSION: 3.4.10
  - RUBY VERSION: 3.2.2 (2023-03-30 patchlevel 53) [x86_64-linux]
  - INSTALLATION DIRECTORY: /tmp/worker/12b6e2/344178/cache/others/bundler
  - USER INSTALLATION DIRECTORY: /home/ubuntu/.local/share/gem/ruby/3.2.0
  - RUBY EXECUTABLE: /opt/containerbase/tools/ruby/3.2.2/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /tmp/worker/12b6e2/344178/cache/others/bundler/bin
  - SPEC CACHE DIRECTORY: /home/ubuntu/.local/share/gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/ruby/3.2.2/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-linux
  - GEM PATHS:
     - /tmp/worker/12b6e2/344178/cache/others/bundler
     - /home/ubuntu/.local/share/gem/ruby/3.2.0
     - /opt/containerbase/tools/ruby/3.2.2/lib/ruby/gems/3.2.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--bindir /home/ubuntu/bin --no-document"
     - :benchmark => false
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/ubuntu/.cargo/bin
     - /home/ubuntu/.local/bin
     - /go/bin
     - /home/ubuntu/bin
     - /home/ubuntu/.cargo/bin
     - /home/ubuntu/.local/bin
     - /go/bin
     - /home/ubuntu/bin
     - /home/ubuntu/.cargo/bin
     - /home/ubuntu/.local/bin
     - /go/bin
     - /home/ubuntu/bin
     - /home/ubuntu/bin
     - /home/ubuntu/.cargo/bin
     - /home/ubuntu/.local/bin
     - /go/bin
     - /home/ubuntu/bin
     - /home/ubuntu/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
[00:27:59.020] INFO (9): Installed tool ruby in 1.9s.
[00:27:59.281] INFO (93): Installing tool bundler v2.2.33...
Successfully installed bundler-2.2.33
1 gem installed
Bundler version 2.2.33
[00:27:59.841] INFO (93): Installed tool bundler in 560ms.
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies.....

Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Bundler could not find compatible versions for gem "activerecord":
  In Gemfile:
    activerecord-nulldb-adapter (~> 0.8) was resolved to 0.8.0, which depends on
      activerecord (>= 5.2.0, < 7.1)

    rails (= 7.1.2) was resolved to 7.1.2, which depends on
      activerecord (= 7.1.2)