Update dependency rails to '~> 7.2.0', '>= 7.2.3'
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| rails (source, changelog) | '~> 7.0.8', '>= 7.0.8.7' -> '~> 7.2.0', '>= 7.2.3' |
Release Notes
rails/rails (rails)
v7.2.3: 7.2.3
Active Support
-
Fix
Enumerable#soleto return the full tuple instead of just the first element of the tuple.Olivier Bellone
-
Fix parallel tests hanging when worker processes die abruptly.
Previously, if a worker process was killed (e.g., OOM killed,
kill -9) during parallel test execution, the test suite would hang forever waiting for the dead worker.Joshua Young
-
ActiveSupport::FileUpdateCheckerdoes not depend onTime.nowto prevent unnecessary reloads with time travel test helpersJan Grodowski
-
Fix
ActiveSupport::BroadcastLoggerfrom executing a block argument for each logger (tagged, info, etc.).Jared Armstrong
-
Fix
ActiveSupport::HashWithIndifferentAccess#transform_keys!removing defaults.Hartley McGuire
-
Fix
ActiveSupport::HashWithIndifferentAccess#tranform_keys!to handle collisions.If the transformation would result in a key equal to another not yet transformed one, it would result in keys being lost.
Before:
>> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ) => {"c" => 1}After:
>> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ) => {"c" => 1, "d" => 2}Jason T Johnson, Jean Boussier
-
Fix
ActiveSupport::Cache::MemCacheStore#read_multito handle network errors.This method specifically wasn't handling network errors like other codepaths.
Alessandro Dal Grande
-
Fix Active Support Cache
fetch_multiwhen local store is active.fetch_multinow properly yield to the provided block for missing entries that have been recorded as such in the local store.Jean Boussier
-
Fix execution wrapping to report all exceptions, including
Exception.If a more serious error like
SystemStackErrororNoMemoryErrorhappens, the error reporter should be able to report these kinds of exceptions.Gannon McGibbon
-
Fix
RedisCacheStoreandMemCacheStoreto also handle connection pool related errors.These errors are rescued and reported to
Rails.error.Jean Boussier
-
Fix
ActiveSupport::Cache#read_multito respect version expiry when using local cache.zzak
-
Fix
ActiveSupport::MessageVerifierandActiveSupport::MessageEncryptorconfiguration ofon_rotationcallback.verifier.rotate(old_secret).on_rotation { ... }Now both work as documented.
Jean Boussier
-
Fix
ActiveSupport::MessageVerifierto always be able to verify both URL-safe and URL-unsafe payloads.This is to allow transitioning seemlessly from either configuration without immediately invalidating all previously generated signed messages.
Jean Boussier, Florent Beaurain, Ali Sepehri
-
Fix
cache.fetchto honor the provided expiry when:race_condition_ttlis used.cache.fetch("key", expires_in: 1.hour, race_condition_ttl: 5.second) do "something" endIn the above example, the final cache entry would have a 10 seconds TTL instead of the requested 1 hour.
Dhia
-
Better handle procs with splat arguments in
set_callback.Radamés Roriz
-
Fix
String#mb_charsto not mutate the receiver.Previously it would call
force_encodingon the receiver, now it dups the receiver first.Jean Boussier
-
Improve
ErrorSubscriberto also mark error causes as reported.This avoid some cases of errors being reported twice, notably in views because of how errors are wrapped in
ActionView::Template::Error.Jean Boussier
-
Fix
Module#module_parent_nameto return the correct name after the module has been named.When called on an anonymous module, the return value wouldn't change after the module was given a name later by being assigned to a constant.
mod = Module.new mod.module_parent_name # => "Object" MyModule::Something = mod mod.module_parent_name # => "MyModule"Jean Boussier
-
Fix a bug in
ERB::Util.tokenizethat causes incorrect tokenization when ERB tags are preceeded by multibyte characters.Martin Emde
Active Model
-
Fix
has_secure_passwordto perform confirmation validation of the password even when blank.The validation was incorrectly skipped when the password only contained whitespace characters.
Fabio Sangiovanni
-
Handle missing attributes for
ActiveModel::Translation#human_attribute_name.zzak
-
Fix
ActiveModel::AttributeAssignment#assign_attributesto accept objects withouteach.Kouhei Yanagita
Active Record
-
Fix SQLite3 data loss during table alterations with CASCADE foreign keys.
When altering a table in SQLite3 that is referenced by child tables with
ON DELETE CASCADEforeign keys, ActiveRecord would silently delete all data from the child tables. This occurred because SQLite requires table recreation for schema changes, and during this process the original table is temporarily dropped, triggering CASCADE deletes on child tables.The root cause was incorrect ordering of operations. The original code wrapped
disable_referential_integrityinside a transaction, butPRAGMA foreign_keyscannot be modified inside a transaction in SQLite - attempting to do so simply has no effect. This meant foreign keys remained enabled during table recreation, causing CASCADE deletes to fire.The fix reverses the order to follow the official SQLite 12-step ALTER TABLE procedure:
disable_referential_integritynow wraps the transaction instead of being wrapped by it. This ensures foreign keys are properly disabled before the transaction starts and re-enabled after it commits, preventing CASCADE deletes while maintaining data integrity through atomic transactions.Ruy Rocha
-
Fix
belongs_toassociations not to clear the entire composite primary key.When clearing a
belongs_toassociation that references a model with composite primary key, only the optional part of the key should be cleared.zzak
-
Fix invalid records being autosaved when distantly associated records are marked for deletion.
Ian Terrell, axlekb AB
-
Prevent persisting invalid record.
Edouard Chin
-
Fix count with group by qualified name on loaded relation.
Ryuta Kamizono
-
Fix
sumwith qualified name on loaded relation.Chris Gunther
-
Fix prepared statements on mysql2 adapter.
Jean Boussier
-
Fix query cache for pinned connections in multi threaded transactional tests.
When a pinned connection is used across separate threads, they now use a separate cache store for each thread.
This improve accuracy of system tests, and any test using multiple threads.
Heinrich Lee Yu, Jean Boussier
-
Don't add
id_valueattribute alias when attribute/column with that name already exists.Rob Lewis
-
Fix false positive change detection involving STI and polymorhic has one relationships.
Polymorphic
has_onerelationships would always be considered changed when defined in a STI child class, causing nedless extra autosaves.David Fritsch
-
Fix stale associaton detection for polymophic
belong_to.Florent Beaurain, Thomas Crambert
-
Fix removal of PostgreSQL version comments in
structure.sqlfor latest PostgreSQL versions which include\restrict.Brendan Weibrecht
-
Fix
#mergewith#oror#andand a mixture of attributes and SQL strings resulting in an incorrect query.base = Comment.joins(:post).where(user_id: 1).where("recent = 1") puts base.merge(base.where(draft: true).or(Post.where(archived: true))).to_sqlBefore:
SELECT "comments".* FROM "comments" INNER JOIN "posts" ON "posts"."id" = "comments"."post_id" WHERE (recent = 1) AND ( "comments"."user_id" = 1 AND (recent = 1) AND "comments"."draft" = 1 OR "posts"."archived" = 1 )After:
SELECT "comments".* FROM "comments" INNER JOIN "posts" ON "posts"."id" = "comments"."post_id" WHERE "comments"."user_id" = 1 AND (recent = 1) AND ( "comments"."user_id" = 1 AND (recent = 1) AND "comments"."draft" = 1 OR "posts"."archived" = 1 )Joshua Young
-
Fix inline
has_and_belongs_to_manyfixtures for tables with composite primary keys.fatkodima
-
Fix
annotatecomments to propagate toupdate_all/delete_all.fatkodima
-
Fix checking whether an unpersisted record is
include?d in a strictly loadedhas_and_belongs_to_manyassociation.Hartley McGuire
-
Fix inline has_and_belongs_to_many fixtures for tables with composite primary keys.
fatkodima
-
create_or_find_bywill now correctly rollback a transaction.When using
create_or_find_by, raising a ActiveRecord::Rollback error in aafter_savecallback had no effect, the transaction was committed and a record created.Edouard Chin
-
Gracefully handle
Timeout.timeoutfiring during connection configuration.Use of
Timeout.timeoutcould result in improperly initialized database connection.This could lead to a partially configured connection being used, resulting in various exceptions, the most common being with the PostgreSQLAdapter raising
undefined method 'key?' for nilorTypeError: wrong argument type nil (expected PG::TypeMap).Jean Boussier
-
The SQLite3 adapter quotes non-finite Numeric values like "Infinity" and "NaN".
Mike Dalessio
-
Handle libpq returning a database version of 0 on no/bad connection in
PostgreSQLAdapter.Before, this version would be cached and an error would be raised during connection configuration when comparing it with the minimum required version for the adapter. This meant that the connection could never be successfully configured on subsequent reconnection attempts.
Now, this is treated as a connection failure consistent with libpq, raising a
ActiveRecord::ConnectionFailedand ensuring the version isn't cached, which allows the version to be retrieved on the next connection attempt.Joshua Young, Rian McGuire
-
Fix error handling during connection configuration.
Active Record wasn't properly handling errors during the connection configuration phase. This could lead to a partially configured connection being used, resulting in various exceptions, the most common being with the PostgreSQLAdapter raising
undefined methodkey?' for nilorTypeError: wrong argument type nil (expected PG::TypeMap)`.Jean Boussier
-
Fix a case where a non-retryable query could be marked retryable.
Hartley McGuire
-
Handle circular references when autosaving associations.
zzak
-
Prevent persisting invalid record.
Edouard Chin
-
Fix support for PostgreSQL enum types with commas in their name.
Arthur Hess
-
Fix inserts on MySQL with no RETURNING support for a table with multiple auto populated columns.
Nikita Vasilevsky
-
Fix joining on a scoped association with string joins and bind parameters.
class Instructor < ActiveRecord::Base has_many :instructor_roles, -> { active } end class InstructorRole < ActiveRecord::Base scope :active, -> { joins("JOIN students ON instructor_roles.student_id = students.id") .where(students { status: 1 }) } end Instructor.joins(:instructor_roles).firstThe above example would result in
ActiveRecord::StatementInvalidbecause theactivescope bind parameters would be lost.Jean Boussier
-
Fix a potential race condition with system tests and transactional fixtures.
Sjoerd Lagarde
-
Fix count with group by qualified name on loaded relation.
Ryuta Kamizono
-
Fix sum with qualified name on loaded relation.
Chris Gunther
-
Fix autosave associations to no longer validated unmodified associated records.
Active Record was incorrectly performing validation on associated record that weren't created nor modified as part of the transaction:
Post.create!(author: User.find(1)) # Fail if user is invalidJean Boussier
-
Remember when a database connection has recently been verified (for two seconds, by default), to avoid repeated reverifications during a single request.
This should recreate a similar rate of verification as in Rails 7.1, where connections are leased for the duration of a request, and thus only verified once.
Matthew Draper
-
Fix prepared statements on mysql2 adapter.
Jean Boussier
-
Fix a race condition in
ActiveRecord::Base#method_missingwhen lazily defining attributes.If multiple thread were concurrently triggering attribute definition on the same model, it could result in a
NoMethodErrorbeing raised.Jean Boussier
-
Fix MySQL default functions getting dropped when changing a column's nullability.
Bastian Bartmann
-
Fix
add_unique_constraint/add_check_constraint//add_foreign_key` to be revertible when given invalid options.fatkodima
-
Fix asynchronous destroying of polymorphic
belongs_toassociations.fatkodima
-
NOT VALID constraints should not dump in
create_table.Ryuta Kamizono
-
Fix finding by nil composite primary key association.
fatkodima
-
Fix parsing of SQLite foreign key names when they contain non-ASCII characters
Zacharias Knudsen
-
Fix parsing of MySQL 8.0.16+ CHECK constraints when they contain new lines.
Steve Hill
-
Ensure normalized attribute queries use
IS NULLconsistently forniland normalizednilvalues.Joshua Young
-
Restore back the ability to pass only database name for
DATABASE_URL.fatkodima
-
Fix
orderwith using association name as an alias.Ryuta Kamizono
-
Improve invalid argument error for with.
Ryuta Kamizono
-
Deduplicate
withCTE expressions.fatkodima
Action View
-
Fix
javascript_include_tagtypeoption to accept either strings and symbols.javascript_include_tag "application", type: :module javascript_include_tag "application", type: "module"Previously, only the string value was recoginized.
Jean Boussier
-
Fix
excerpthelper with non-whitespace separator.Jonathan Hefner
-
Respect
html_options[:form]whencollection_checkboxesgenerates the hidden<input>.Riccardo Odone
-
Layouts have access to local variables passed to
render.This fixes #31680 which was a regression in Rails 5.1.
Mike Dalessio
-
Argument errors related to strict locals in templates now raise an
ActionView::StrictLocalsError, and all other argument errors are reraised as-is.Previously, any
ArgumentErrorraised during template rendering was swallowed during strict local error handling, so that anArgumentErrorunrelated to strict locals (e.g., a helper method invoked with incorrect arguments) would be replaced by a similarArgumentErrorwith an unrelated backtrace, making it difficult to debug templates.Now, any
ArgumentErrorunrelated to strict locals is reraised, preserving the original backtrace for developers.Also note that
ActionView::StrictLocalsErroris a subclass ofArgumentError, so any existing code that rescuesArgumentErrorwill continue to work.Fixes #52227.
Mike Dalessio
-
Fix stack overflow error in dependency tracker when dealing with circular dependencies
Jean Boussier
-
Fix a crash in ERB template error highlighting when the error occurs on a line in the compiled template that is past the end of the source template.
Martin Emde
-
Improve reliability of ERB template error highlighting. Fix infinite loops and crashes in highlighting and improve tolerance for alternate ERB handlers.
Martin Emde
Action Pack
-
Submit test requests using
as: :htmlwithContent-Type: x-www-form-urlencodedSean Doyle
-
Address
rack 3.2deprecations warnings.warning: Status code :unprocessable_entity is deprecated and will be removed in a future version of Rack. Please use :unprocessable_content instead.Rails API will transparently convert one into the other for the forseable future.
Earlopain, Jean Boussier
-
Always return empty body for HEAD requests in
PublicExceptionsandDebugExceptions.This is required by
Rack::Lint(per RFC9110).Hartley McGuire
-
Fix
url_forto handle:path_paramsgracefully when it's not aHash.Prevents various security scanners from causing exceptions.
Martin Emde
-
Fix
ActionDispatch::Executorto unwrap exceptions like other error reporting middlewares.Jean Boussier
-
Fix NoMethodError when a non-string CSRF token is passed through headers.
Ryan Heneise
-
Fix invalid response when rescuing
ActionController::Redirecting::UnsafeRedirectErrorin a controller.Alex Ghiculescu
Active Job
-
Include the actual Active Job locale when serializing rather than I18n locale.
Adrien S
-
Avoid crashing in Active Job logger when logging enqueueing errors
ActiveJob.perform_all_latercould fail with aTypeErrorwhen all provided jobs failed to be enqueueed.Efstathios Stivaros
Action Mailer
- No changes.
Action Cable
-
Fixed compatibility with
redisgem5.4.1Jean Boussier
-
Fixed a possible race condition in
stream_from.OuYangJinTing
-
Ensure the Postgresql adapter always use a dedicated connection even during system tests.
Fix an issue with the Action Cable Postgresql adapter causing deadlock or various weird pg client error during system tests.
Jean Boussier
Active Storage
-
Fix
config.active_storage.touch_attachment_recordsto work with eager loading.fatkodima
-
A Blob will no longer autosave associated Attachment.
This fixes an issue where a record with an attachment would have its dirty attributes reset, preventing your
after commitcallbacks on that record to behave as expected.Note that this change doesn't require any changes on your application and is supposed to be internal. Active Storage Attachment will continue to be autosaved (through a different relation).
Edouard-chin
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
-
Use
secret_key_basefrom ENV or credentials when present locally.When ENV["SECRET_KEY_BASE"] or
Rails.application.credentials.secret_key_baseis set for test or development, it is used for theRails.config.secret_key_base, instead of generating atmp/local_secret.txtfile.Petrik de Heus
Guides
- No changes.
v7.2.2.2: 7.2.2.2
Active Support
- No changes.
Active Model
- No changes.
Active Record
-
Call inspect on ids in RecordNotFound error
[CVE-2025-55193]
Gannon McGibbon, John Hawthorn
Action View
- No changes.
Action Pack
- No changes.
Active Job
- No changes.
Action Mailer
- No changes.
Action Cable
- No changes.
Active Storage
Remove dangerous transformations
[CVE-2025-24293]
*Zack Deveau*
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
- No changes.
Guides
- No changes.
v7.2.2.1: 7.2.2.1
Active Support
- No changes.
Active Model
- No changes.
Active Record
- No changes.
Action View
- No changes.
Action Pack
-
Add validation to content security policies to disallow spaces and semicolons. Developers should use multiple arguments, and different directive methods instead.
[CVE-2024-54133]
Gannon McGibbon
Active Job
- No changes.
Action Mailer
- No changes.
Action Cable
- No changes.
Active Storage
- No changes.
Action Mailbox
- No changes.
Action Text
-
Update vendored trix version to 2.1.10
John Hawthorn
Railties
- No changes.
Guides
- No changes.
v7.2.2: 7.2.2
Active Support
-
Include options when instrumenting
ActiveSupport::Cache::Store#deleteandActiveSupport::Cache::Store#delete_multi.Adam Renberg Tamm
-
Print test names when running
rails test -vfor parallel tests.John Hawthorn, Abeid Ahmed
Active Model
-
Fix regression in
alias_attributeto work with user defined methods.alias_attributewould wrongly assume the attribute accessor was generated by Active Model.class Person include ActiveModel::AttributeMethods define_attribute_methods :name attr_accessor :name alias_attribute :full_name, :name end person.full_name # => NoMethodError: undefined method `attribute' for an instance of PersonJean Boussier
Active Record
-
Fix support for
query_cache: falseindatabase.yml.query_cache: falsewould no longer entirely disable the Active Record query cache.zzak
-
Set
.attributes_for_inspectto:allby default.For new applications it is set to
[:id]in config/environment/production.rb.In the console all the attributes are always shown.
Andrew Novoselac
-
PG::UnableToSend: no connection to the serveris now retryable as a connection-related exceptionKazuma Watanabe
-
Fix marshalling of unsaved associated records in 7.1 format.
The 7.1 format would only marshal associated records if the association was loaded. But associations that would only contain unsaved records would be skipped.
Jean Boussier
-
Fix incorrect SQL query when passing an empty hash to
ActiveRecord::Base.insert.David Stosik
-
Allow to save records with polymorphic join tables that have
inverse_ofspecified.Markus Doits
-
Fix association scopes applying on the incorrect join when using a polymorphic
has_many through:.Joshua Young
-
Fix
dependent: :destroyfor bi-directional has one through association.Fixes #50948.
class Left < ActiveRecord::Base has_one :middle, dependent: :destroy has_one :right, through: :middle end class Middle < ActiveRecord::Base belongs_to :left, dependent: :destroy belongs_to :right, dependent: :destroy end class Right < ActiveRecord::Base has_one :middle, dependent: :destroy has_one :left, through: :middle endIn the above example
left.destroywouldn't destroy its associatedRightrecord.Andy Stewart
-
Properly handle lazily pinned connection pools.
Fixes #53147.
When using transactional fixtures with system tests to similar tools such as capybara, it could happen that a connection end up pinned by the server thread rather than the test thread, causing
"Cannot expire connection, it is owned by a different thread"errors.Jean Boussier
-
Fix
ActiveRecord::Base.withto accept more than two sub queries.Fixes #53110.
User.with(foo: [User.select(:id), User.select(:id), User.select(:id)]).to_sql undefined method `union' for an instance of Arel::Nodes::UnionAll (NoMethodError)The above now works as expected.
fatkodima
-
Properly release pinned connections with non joinable connections.
Fixes #52973
When running system tests with transactional fixtures on, it could happen that the connection leased by the Puma thread wouldn't be properly released back to the pool, causing "Cannot expire connection, it is owned by a different thread" errors in later tests.
Jean Boussier
-
Make Float distinguish between
float4andfloat8in PostgreSQL.Fixes #52742
Ryota Kitazawa, Takayuki Nagatomi
-
Fix an issue where
.left_outer_joinsused with multiple associations that have the same child association but different parents does not join all parents.Previously, using
.left_outer_joinswith the same child association would only join one of the parents.Now it will correctly join both parents.
Fixes #41498.
Garrett Blehm
-
Ensure
ActiveRecord::Encryption.configis always ready before access.Previously,
ActiveRecord::Encryptionconfiguration was deferred untilActiveRecord::Basewas loaded. Therefore, accessingActiveRecord::Encryption.configproperties beforeActiveRecord::Basewas loaded would give incorrect results.ActiveRecord::Encryptionnow has its own loading hook so that its configuration is set as soon as needed.When
ActiveRecord::Baseis loaded, even lazily, it in turn triggers the loading ofActiveRecord::Encryption, thus preserving the original behavior of having its config ready before any use ofActiveRecord::Base.Maxime Réty
-
Add
TimeZoneConverter#==method, so objects will be properly compared by their type, scale, limit & precision.Address #52699.
Ruy Rocha
Action View
- No changes.
Action Pack
-
Fix non-GET requests not updating cookies in
ActionController::TestCase.Jon Moss, Hartley McGuire
Active Job
- No changes.
Action Mailer
- No changes.
Action Cable
- No changes.
Active Storage
- No changes.
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
- No changes.
Guides
- No changes.
v7.2.1.2: 7.2.1.2
Active Support
- No changes.
Active Model
- No changes.
Active Record
- No changes.
Action View
- No changes.
Action Pack
- No changes.
Active Job
- No changes.
Action Mailer
-
Fix NoMethodError in
block_formathelperMichael Leimstaedtner
Action Cable
- No changes.
Active Storage
- No changes.
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
- No changes.
Guides
- No changes.
v7.2.1.1: 7.2.1.1
Active Support
- No changes.
Active Model
- No changes.
Active Record
- No changes.
Action View
- No changes.
Action Pack
-
Avoid regex backtracking in HTTP Token authentication
[CVE-2024-47887]
-
Avoid regex backtracking in query parameter filtering
[CVE-2024-41128]
Active Job
- No changes.
Action Mailer
-
Avoid regex backtracking in
block_formathelper[CVE-2024-47889]
Action Cable
- No changes.
Active Storage
- No changes.
Action Mailbox
- No changes.
Action Text
-
Avoid backtracing in plain_text_for_blockquote_node
[CVE-2024-47888]
Railties
- No changes.
Guides
- No changes.
v7.2.1: 7.2.1
Active Support
- No changes.
Active Model
- No changes.
Active Record
-
Fix detection for
enumcolumns with parallelized tests and PostgreSQL.Rafael Mendonça França
-
Allow to eager load nested nil associations.
fatkodima
-
Fix swallowing ignore order warning when batching using
BatchEnumerator.fatkodima
-
Fix memory bloat on the connection pool when using the Fiber
IsolatedExecutionState.Jean Boussier
-
Restore inferred association class with the same modularized name.
Justin Ko
-
Fix
ActiveRecord::Base.inspectto properly explain how to load schema information.Jean Boussier
-
Check invalid
enumoptions for the new syntax.The options using
_prefix in the old syntax are invalid in the new syntax.Rafael Mendonça França
-
Fix
ActiveRecord::Encryption::EncryptedAttributeType#typeto return actual cast type.Vasiliy Ermolovich
-
Fix
create_tablewith:auto_incrementoption for MySQL adapter.fatkodima
Action View
- No changes.
Action Pack
-
Fix
Request#raw_postraisingNoMethodErrorwhenrack.inputisnil.Hartley McGuire
Active Job
- No changes.
Action Mailer
- No changes.
Action Cable
- No changes.
Active Storage
- No changes.
Action Mailbox
- No changes.
Action Text
-
Strip
contentattribute if the key is present but the value is emptyJeremy Green
Railties
-
Fix
rails consolefor application with non default application constant.The wrongly assumed the Rails application would be named
AppNamespace::Application, which is the default but not an obligation.Jean Boussier
-
Fix the default Dockerfile to include the full sqlite3 package.
Prior to this it only included
libsqlite3, so it wasn't enough to runrails dbconsole.Jerome Dalbert
-
Don't update public directory during
app:updatecommand for API-only Applications.y-yagi
-
Don't add bin/brakeman if brakeman is not in bundle when upgrading an application.
Etienne Barrié
-
Remove PWA views and routes if its an API only project.
Jean Boussier
-
Simplify generated Puma configuration
DHH, Rafael Mendonça França
v7.2.0: 7.2.0
Active Support
-
Fix
delegate_missing_to allow_nil: truewhen called with implict selfclass Person delegate_missing_to :address, allow_nil: true def address nil end def berliner? city == "Berlin" end end Person.new.city # => nil Person.new.berliner? # undefined local variable or method `city' for an instance of Person (NameError)Jean Boussier
-
Add
loggeras a dependency since it is a bundled gem candidate for Ruby 3.5Earlopain
-
Define
Digest::UUID.nil_uuid, which returns the so-called nil UUID.Xavier Noria
-
Support
durationtype inActiveSupport::XmlMini.heka1024
-
Remove deprecated
ActiveSupport::Notifications::Event#childrenandActiveSupport::Notifications::Event#parent_of?.Rafael Mendonça França
-
Remove deprecated support to call the following methods without passing a deprecator:
-
deprecate -
deprecate_constant -
ActiveSupport::Deprecation::DeprecatedObjectProxy.new -
ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new -
ActiveSupport::Deprecation::DeprecatedConstantProxy.new -
assert_deprecated -
assert_not_deprecated -
collect_deprecations
Rafael Mendonça França
-
-
Remove deprecated
ActiveSupport::Deprecationdelegation to instance.Rafael Mendonça França
-
Remove deprecated
SafeBuffer#clone_empty.Rafael Mendonça França
-
Remove deprecated
#to_default_sfromArray,Date,DateTimeandTime.Rafael Mendonça França
-
Remove deprecated support to passing
Dalli::Clientinstances toMemCacheStore.Rafael Mendonça França
-
Remove deprecated
config.active_support.use_rfc4122_namespaced_uuids.Rafael Mendonça França
-
Remove deprecated
config.active_support.remove_deprecated_time_with_zone_name.Rafael Mendonça França
-
Remove deprecated
config.active_support.disable_to_s_conversion.Rafael Mendonça França
-
Remove deprecated support to bolding log text with positional boolean in
ActiveSupport::LogSubscriber#color.Rafael Mendonça França
-
Remove deprecated constants
ActiveSupport::LogSubscriber::CLEARandActiveSupport::LogSubscriber::BOLD.Rafael Mendonça França
-
Remove deprecated support for
config.active_support.cache_format_version = 6.1.Rafael Mendonça França
-
Remove deprecated
:pool_sizeand:pool_timeoutoptions for the cache storage.Rafael Mendonça França
-
Warn on tests without assertions.
ActiveSupport::TestCasenow warns when tests do not run any assertions. This is helpful in detecting broken tests that do not perform intended assertions.fatkodima
-
Support
hexBinarytype inActiveSupport::XmlMini.heka1024
-
Deprecate
ActiveSupport::ProxyObjectin favor of Ruby's built-inBasicObject.Earlopain
-
stub_constnow accepts aexists: falseparameter to allow stubbing missing constants.Jean Boussier
-
Make
ActiveSupport::BacktraceCleanercopy filters and silencers on dup and clone.Previously the copy would still share the internal silencers and filters array, causing state to leak.
Jean Boussier
-
Updating Astana with Western Kazakhstan TZInfo identifier.
Damian Nelson
-
Add filename support for
ActiveSupport::Logger.logger_outputs_to?.logger = Logger.new('/var/log/rails.log') ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')Christian Schmidt
-
Include
IPAddr#prefixwhen serializing anIPAddrusing theActiveSupport::MessagePackserializer.This change is backward and forward compatible — old payloads can still be read, and new payloads will be readable by older versions of Rails.
Taiki Komaba
-
Add
default:support forActiveSupport::CurrentAttributes.attribute.class Current < ActiveSupport::CurrentAttributes attribute :counter, default: 0 endSean Doyle
-
Yield instance to
Object#withblock.client.with(timeout: 5_000) do |c| c.get("/commits") endSean Doyle
-
Use logical core count instead of physical core count to determine the default number of workers when parallelizing tests.
Jonathan Hefner
-
Fix
Time.now/DateTime.now/Date.todayto return results in a system timezone after#travel_to.There is a bug in the current implementation of #travel_to: it remembers a timezone of its argument, and all stubbed methods start returning results in that remembered timezone. However, the expected behavior is to return results in a system timezone.
Aleksei Chernenkov
-
Add
ErrorReported#unexpectedto report precondition violations.For example:
def edit if published? Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible") return false end
...
end
```
The above will raise an error in development and test, but only report the error in production.
*Jean Boussier*
-
Make the order of read_multi and write_multi notifications for
Cache::Store#fetch_multioperations match the order they are executed in.Adam Renberg Tamm
-
Make return values of
Cache::Store#writeconsistent.The return value was not specified before. Now it returns
trueon a successful write,nilif there was an error talking to the cache backend, andfalseif the write failed for another reason (e.g. the key already exists andunless_exist: truewas passed).Sander Verdonschot
-
Fix logged cache keys not always matching actual key used by cache action.
Hartley McGuire
-
Improve error messages of
assert_changesandassert_no_changes.assert_changeserror messages now display objects with.inspectto make it easier to differentiate nil from empty strings, strings from symbols, etc.assert_no_changeserror messages now surface the actual value.pcreux
-
Fix
#to_fs(:human_size)to correctly work with negative numbers.Earlopain
-
Fix
BroadcastLogger#dupso that it duplicates the logger'sbroadcasts.Andrew Novoselac
-
Fix issue where
bootstrap.rboverwrites thelevelof aBroadcastLogger'sbroadcasts.Andrew Novoselac
-
Fix compatibility with the
semantic_loggergem.The
semantic_loggergem doesn't behave exactly like stdlib logger in thatSemanticLogger#levelreturns a Symbol while stdlibLogger#levelreturns an Integer.This caused the various
LogSubscriberclasses in Rails to break when assigned aSemanticLoggerinstance.Jean Boussier, ojab
-
Fix MemoryStore to prevent race conditions when incrementing or decrementing.
Pierre Jambet
-
Implement
HashWithIndifferentAccess#to_proc.Previously, calling
#to_proconHashWithIndifferentAccessobject used inherited#to_procmethod from theHashclass, which was not able to access values using indifferent keys.fatkodima
Active Model
-
Fix a bug where type casting of string to
TimeandDateTimedoesn't calculate minus minute value in TZ offset correctly.Akira Matsuda
-
Port the
type_for_attributemethod to Active Model. Classes that includeActiveModel::Attributeswill now provide this method. This method behaves the same for Active Model as it does for Active Record.class MyModel include ActiveModel::Attributes attribute :my_attribute, :integer end MyModel.type_for_attribute(:my_attribute) # => #<ActiveModel::Type::Integer ...>Jonathan Hefner
Active Record
-
Handle commas in Sqlite3 default function definitions.
Stephen Margheim
-
Fixes
validates_associatedraising an exception when configured with a singular association and havingindex_nested_attribute_errorsenabled.Martin Spickermann
-
The constant
ActiveRecord::ImmutableRelationhas been deprecated because we want to reserve that name for a stronger sense of "immutable relation". Please useActiveRecord::UnmodifiableRelationinstead.Xavier Noria
-
Add condensed
#inspectforConnectionPool,AbstractAdapter, andDatabaseConfig.Hartley McGuire
-
Fixed a memory performance issue in Active Record attribute methods definition.
Jean Boussier
-
Define the new Active Support notification event
start_transaction.active_record.This event is fired when database transactions or savepoints start, and complements
transaction.active_record, which is emitted when they finish.The payload has the transaction (
:transaction) and the connection (:connection).Xavier Noria
-
Fix an issue where the IDs reader method did not return expected results for preloaded associations in models using composite primary keys.
Jay Ang
-
The payload of
sql.active_recordActive Support notifications now has the current transaction in the:transactionkey.Xavier Noria
-
The payload of
transaction.active_recordActive Support notifications now has the transaction the event is related to in the:transactionkey.Xavier Noria
-
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.Xavier Noria
-
Fix inference of association model on nested models with the same demodularized name.
E.g. with the following setup:
class Nested::Post < ApplicationRecord has_one :post, through: :other endBefore,
#postwould infer the model asNested::Post, but now it correctly infersPost.Joshua Young
-
PostgreSQL
Cidr#change?detects the address prefix change.Taketo Takashima
-
Change
BatchEnumerator#destroy_allto return the total number of affected rows.Previously, it always returned
nil.fatkodima
-
Support
touch_allin batches.Post.in_batches.touch_allfatkodima
-
Add support for
:if_not_existsand:forceoptions tocreate_schema.fatkodima
-
Fix
index_errorshaving incorrect index in association validation errors.lulalala
-
Add
index_errors: :nested_attributes_ordermode.This indexes the association validation errors based on the order received by nested attributes setter, and respects the
reject_ifconfiguration. This enables API to provide enough information to the frontend to map the validation errors back to their respective form fields.lulalala
-
Add
Rails.application.config.active_record.postgresql_adapter_decode_datesto opt out of decoding dates automatically with the postgresql adapter. Defaults to true.Joé Dupuis
-
Association option
query_constraintsis deprecated in favor offoreign_key.Nikita Vasilevsky
-
Add
ENV["SKIP_TEST_DATABASE_TRUNCATE"]flag to speed up multi-process test runs on large DBs when all tests run within default transaction.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.
DHH
-
Added support for recursive common table expressions.
Post.with_recursive( post_and_replies: [ Post.where(id: 42), Post.joins('JOIN post_and_replies ON posts.in_reply_to_id = post_and_replies.id'), ] )Generates the following SQL:
WITH RECURSIVE "post_and_replies" AS ( (SELECT "posts".* FROM "posts" WHERE "posts"."id" = 42) UNION ALL (SELECT "posts".* FROM "posts" JOIN post_and_replies ON posts.in_reply_to_id = post_and_replies.id) ) SELECT "posts".* FROM "posts"ClearlyClaire
-
validate_constraintcan be called in achange_tableblock.ex:
change_table :products do |t| t.check_constraint "price > discounted_price", name: "price_check", validate: false t.validate_check_constraint "price_check" endCody Cutrer
-
PostgreSQLAdapternow decodes columns of type date toDateinstead of string.Ex:
ActiveRecord::Base.connection .select_value("select '2024-01-01'::date").class #=> DateJoé Dupuis
-
Strict loading using
:n_plus_one_onlydoes not eagerly load child associations.With this change, child associations are no longer eagerly loaded, to match intended behavior and to prevent non-deterministic order issues caused by calling methods like
firstorlast. Asfirstandlastdon't cause an N+1 by themselves, calling child associations will no longer raise. Fixes #49473.Before:
person = Person.find(1) person.strict_loading!(mode: :n_plus_one_only) person.posts.first
SELECT * FROM posts WHERE person_id = 1; -- non-deterministic order
person.posts.first.firm # raises ActiveRecord::StrictLoadingViolationError
```
After:
```ruby
person = Person.find(1)
person.strict_loading!(mode: :n_plus_one_only)
person.posts.first # this is 1+1, not N+1
SELECT * FROM posts WHERE person_id = 1 ORDER BY id LIMIT 1;
person.posts.first.firm # no longer raises
```
*Reid Lynch*
-
Allow
Sqlite3Adapterto usesqlite3gem version2.x.Mike Dalessio
-
Allow
ActiveRecord::Base#pluckto accept hash values.
Before
Post.joins(:comments).pluck("posts.id", "comments.id", "comments.body")
After
Post.joins(:comments).pluck(posts: [:id], comments: [:id, :body])
```
*fatkodima*
-
Raise an
ActiveRecord::ActiveRecordErrorerror when the MySQL database returns an invalid version string.Kevin McPhillips
-
ActiveRecord::Base.transactionnow yields anActiveRecord::Transactionobject.This allows to register callbacks on it.
Article.transaction do |transaction| article.update(published: true) transaction.after_commit do PublishNotificationMailer.with(article: article).deliver_later end endJean Boussier
-
Add
ActiveRecord::Base.current_transaction.Returns the current transaction, to allow registering callbacks on it.
Article.current_transaction.after_commit do PublishNotificationMailer.with(article: article).deliver_later endJean Boussier
-
Add
ActiveRecord.after_all_transactions_commitcallback.Useful for code that may run either inside or outside a transaction and needs to perform work after the state changes have been properly persisted.
def publish_article(article) article.update(published: true) ActiveRecord.after_all_transactions_commit do PublishNotificationMailer.with(article: article).deliver_later end endIn the above example, the block is either executed immediately if called outside of a transaction, or called after the open transaction is committed.
If the transaction is rolled back, the block isn't called.
Jean Boussier
-
Add the ability to ignore counter cache columns until they are backfilled.
Starting to use counter caches on existing large tables can be troublesome, because the column values must be backfilled separately of the column addition (to not lock the table for too long) and before the use of
:counter_cache(otherwise methods likesize/any?/etc, which use counter caches internally, can produce incorrect results). People usually use database triggers or callbacks on child associations while backfilling before introducing a counter cache configuration to the association.Now, to safely backfill the column, while keeping the column updated with child records added/removed, use:
class Comment < ApplicationRecord belongs_to :post, counter_cache: { active: false } endWhile the counter cache is not "active", the methods like
size/any?/etc will not use it, but get the results directly from the database. After the counter cache column is backfilled, simply remove the{ active: false }part from the counter cache definition, and it will now be used by the mentioned methods.fatkodima
-
Retry known idempotent SELECT queries on connection-related exceptions.
SELECT queries we construct by walking the Arel tree and / or with known model attributes are idempotent and can safely be retried in the case of a connection error. Previously, adapters such as
TrilogyAdapterwould raiseActiveRecord::ConnectionFailed: Trilogy::EOFErrorwhen encountering a connection error mid-request.Adrianna Chang
-
Allow association's
foreign_keyto be composite.query_constraintsoption was the only way to configure a composite foreign key by passing anArray. Now it's possible to pass an Array value asforeign_keyto achieve the same behavior of an association.Nikita Vasilevsky
-
Allow association's
primary_keyto be composite.Association's
primary_keycan be composite when derived from associated modelprimary_keyorquery_constraints. Now it's possible to explicitly set it as composite on the association.Nikita Vasilevsky
-
Add
config.active_record.permanent_connection_checkoutsetting.Controls whether
ActiveRecord::Base.connectionraises an error, emits a deprecation warning, or neither.ActiveRecord::Base.connectioncheckouts a database connection from the pool and keeps it leased until the end of the request or job. This behavior can be undesirable in environments that use many more threads or fibers than there is available connections.This configuration can be used to track down and eliminate code that calls
ActiveRecord::Base.connectionand migrate it to useActiveRecord::Base.with_connectioninstead.The default behavior remains unchanged, and there is currently no plans to change the default.
Jean Boussier
-
Add dirties option to uncached.
This adds a
dirtiesoption toActiveRecord::Base.uncachedandActiveRecord::ConnectionAdapters::ConnectionPool#uncached.When set to
true(the default), writes will clear all query caches belonging to the current thread. When set tofalse, writes to the affected connection pool will not clear any query cache.This is needed by Solid Cache so that cache writes do not clear query caches.
Donal McBreen
-
Deprecate
ActiveRecord::Base.connectionin favor of.lease_connection.The method has been renamed as
lease_connectionto better reflect that the returned connection will be held for the duration of the request or job.This deprecation is a soft deprecation, no warnings will be issued and there is no current plan to remove the method.
Jean Boussier
-
Deprecate
ActiveRecord::ConnectionAdapters::ConnectionPool#connection.The method has been renamed as
lease_connectionto better reflect that the returned connection will be held for the duration of the request or job.Jean Boussier
-
Expose a generic fixture accessor for fixture names that may conflict with Minitest.
assert_equal "Ruby on Rails", web_sites(:rubyonrails).name assert_equal "Ruby on Rails", fixture(:web_sites, :rubyonrails).nameJean Boussier
-
Using
Model.query_constraintswith a single non-primary-key column used to raise as expected, but with an incorrect error message.This has been fixed to raise with a more appropriate error message.
Joshua Young
-
Fix
has_oneassociation autosave setting the foreign key attribute when it is unchanged.This behavior is also inconsistent with autosaving
belongs_toand can have unintended side effects like raising anActiveRecord::ReadonlyAttributeErrorwhen the foreign key attribute is marked as read-only.Joshua Young
-
Remove deprecated behavior that would rollback a transaction block when exited using
return,breakorthrow.Rafael Mendonça França
-
Deprecate
Rails.application.config.active_record.commit_transaction_on_non_local_return.Rafael Mendonça França
-
Remove deprecated support to pass
rewheretoActiveRecord::Relation#merge.Rafael Mendonça França
-
Remove deprecated support to pass
deferrable: truetoadd_foreign_key.Rafael Mendonça França
-
Remove deprecated support to quote
ActiveSupport::Duration.Rafael Mendonça França
-
Remove deprecated
#quote_bound_value.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::ConnectionAdapters::ConnectionPool#connection_klass.Rafael Mendonça França
-
Remove deprecated support to apply
#connection_pool_list,#active_connections?,#clear_active_connections!,#clear_reloadable_connections!,#clear_all_connections!and#flush_idle_connections!to the connections pools for the current role when theroleargument isn't provided.Rafael Mendonça França
-
Remove deprecated
#all_connection_pools.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::ConnectionAdapters::SchemaCache#data_sources.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::ConnectionAdapters::SchemaCache.load_from.Rafael Mendonça França
-
Remove deprecated
#all_foreign_keys_valid?from database adapters.Rafael Mendonça França
-
Remove deprecated support to passing coder and class as second argument to
serialize.Rafael Mendonça França
-
Remove deprecated support to
ActiveRecord::Base#read_attribute(:id)to return the custom primary key value.Rafael Mendonça França
-
Remove deprecated
TestFixtures.fixture_path.Rafael Mendonça França
-
Remove deprecated behavior to support referring to a singular association by its plural name.
Rafael Mendonça França
-
Deprecate
Rails.application.config.active_record.allow_deprecated_singular_associations_name.Rafael Mendonça França
-
Remove deprecated support to passing
SchemaMigrationandInternalMetadataclasses as arguments toActiveRecord::MigrationContext.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::Migration.check_pending!method.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::LogSubscriber.runtimemethod.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::LogSubscriber.runtime=method.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::LogSubscriber.reset_runtimemethod.Rafael Mendonça França
-
Remove deprecated support to define
explainin the connection adapter with 2 arguments.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::ActiveJobRequiredError.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::Base.clear_active_connections!.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::Base.clear_reloadable_connections!.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::Base.clear_all_connections!.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::Base.flush_idle_connections!.Rafael Mendonça França
-
Remove deprecated
nameargument fromActiveRecord::Base.remove_connection.Rafael Mendonça França
-
Remove deprecated support to call
alias_attributewith non-existent attribute names.Rafael Mendonça França
-
Remove deprecated
Rails.application.config.active_record.suppress_multiple_database_warning.Rafael Mendonça França
-
Add
ActiveRecord::Encryption::MessagePackMessageSerializer.Serialize data to the MessagePack format, for efficient storage in binary columns.
The binary encoding requires around 30% less space than the base64 encoding used by the default serializer.
Donal McBreen
-
Add support for encrypting binary columns.
Ensure encryption and decryption pass
Type::Binary::Dataaround for binary data.Previously encrypting binary columns with the
ActiveRecord::Encryption::MessageSerializerincidentally worked for MySQL and SQLite, but not PostgreSQL.Donal McBreen
-
Deprecated
ENV["SCHEMA_CACHE"]in favor ofschema_cache_pathin the database configuration.Rafael Mendonça França
-
Add
ActiveRecord::Base.with_connectionas a shortcut for leasing a connection for a short duration.The leased connection is yielded, and for the duration of the block, any call to
ActiveRecord::Base.connectionwill yield that same connection.This is useful to perform a few database operations without causing a connection to be leased for the entire duration of the request or job.
Jean Boussier
-
Deprecate
config.active_record.warn_on_records_fetched_greater_thannow thatsql.active_recordnotification includes:row_countfield.Jason Nochlin
-
The fix ensures that the association is joined using the appropriate join type (either inner join or left outer join) based on the existing joins in the scope.
This prevents unintentional overrides of existing join types and ensures consistency in the generated SQL queries.
Example:
associated will use LEFT JOIN instead of using JOIN
Post.left_joins(:author).where.associated(:author)
```
*Saleh Alhaddad*
-
Fix an issue where
ActiveRecord::Encryptionconfigurations are not ready before the loading of Active Record models, when an application is eager loaded. As a result, encrypted attributes could be misconfigured in some cases.Maxime Réty
-
Deprecate defining an
enumwith keyword arguments.class Function > ApplicationRecord
BAD
enum color: [:red, :blue],
type: [:instance, :class]
GOOD
enum :color, [:red, :blue]
enum :type, [:instance, :class]
end
```
*Hartley Mc
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), 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.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/ManageIQ/miq_bot).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xODUuNCIsInVwZGF0ZWRJblZlciI6IjQyLjEzLjUiLCJ0YXJnZXRCcmFuY2giOiJtYXN0ZXIiLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->