Update dependency activerecord to v7 #136
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
"~> 6.1.4"->"~> 7.1.0"Release Notes
rails/rails (activerecord)
v7.1.3.2Compare Source
Active Support
Active Model
Active Record
Action View
Action Pack
raise_on_missing_translationsnot working correctly with thetranslatemethod in controllers after the patch for CVE-2024-26143.Active Job
Action Mailer
Action Cable
Active Storage
Action Mailbox
Action Text
Railties
v7.1.3.1: 7.1.3.1Compare Source
Active Support
Active Model
Active Record
Action View
Action Pack
Fix possible XSS vulnerability with the
translatemethod in controllersCVE-2024-26143
Fix ReDoS in Accept header parsing
CVE-2024-26142
Active Job
Action Mailer
Action Cable
Active Storage
Action Mailbox
Action Text
Railties
v7.1.3: 7.1.3Compare Source
Active Support
Handle nil
backtrace_locationsinActiveSupport::SyntaxErrorProxy.Eugene Kenny
Fix
ActiveSupport::JSON.encodeto prevent duplicate keys.If the same key exist in both String and Symbol form it could
lead to the same key being emitted twice.
Manish Sharma
Fix
ActiveSupport::Cache::Store#read_multiwhen using a cache namespaceand local cache strategy.
Mark Oleson
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
behaviour is to return results in a system timezone.
Aleksei Chernenkov
Fix
:unless_existoption forMemoryStore#write(et al) when using acache namespace.
S. Brent Faulkner
Fix ActiveSupport::Deprecation to handle blaming generated code.
Jean Boussier, fatkodima
Active Model
Active Record
Fix Migrations with versions older than 7.1 validating options given to
add_reference.Hartley McGuire
Ensure
reloadsets correct owner for each association.Dmytro Savochkin
Fix view runtime for controllers with async queries.
fatkodima
Fix
load_asyncto work with query cache.fatkodima
Fix polymorphic
belongs_toto correctly use parent'squery_constraints.fatkodima
Fix
Preloaderto not generate a query for already loaded association withquery_constraints.fatkodima
Fix multi-database polymorphic preloading with equivalent table names.
When preloading polymorphic associations, if two models pointed to two
tables with the same name but located in different databases, the
preloader would only load one.
Ari Summer
Fix
encrypted_attribute?to take into account context properties passed toencrypts.Maxime Réty
Fix
find_byto work correctly in presence of composite primary keys.fatkodima
Fix async queries sometimes returning a raw result if they hit the query cache.
ShipPart.async_countcould return a raw integer rather than a Promiseif it found the result in the query cache.
fatkodima
Fix
Relation#transactionto not apply a default scope.The method was incorrectly setting a default scope around its block:
Jean Boussier
Fix calling
async_pluckon anonerelation.Model.none.async_pluck(:id)was returning a naked valueinstead of a promise.
Jean Boussier
Fix calling
load_asyncon anonerelation.Model.none.load_asyncwas returning a broken result.Lucas Mazza
TrilogyAdapter: ignore
hostifsocketparameter is set.This allows to configure a connection on a UNIX socket via DATABASE_URL:
Jean Boussier
Fix
has_secure_tokencalls the setter method on initialize.Abeid Ahmed
Allow using
object_idas a database column name.It was available before rails 7.1 and may be used as a part of polymorphic relationship to
objectwhereobjectcan be any other database record.Mikhail Doronin
Fix
rails db:create:allto not touch databases before they are created.fatkodima
Action View
Better handle SyntaxError in Action View.
Mario Caropreso
Fix
word_wrapwith empty string.Jonathan Hefner
Rename
ActionView::TestCase::Behavior::ContenttoActionView::TestCase::Behavior::RenderedViewContent.Make
RenderedViewContentinherit fromString. Make private API with:nodoc:.Sean Doyle
Fix detection of required strict locals.
Further fix
render @​collectioncompatibility with strict localsJean Boussier
Action Pack
Fix including
Rails.application.routes.url_helpersdirectly in anActiveSupport::Concern.Jonathan Hefner
Fix system tests when using a Chrome binary that has been downloaded by
Selenium.
Jonathan Hefner
Active Job
Do not trigger immediate loading of
ActiveJob::Basewhen loadingActiveJob::TestHelper.Maxime Réty
Preserve the serialized timezone when deserializing
ActiveSupport::TimeWithZonearguments.Joshua Young
Fix ActiveJob arguments serialization to correctly serialize String subclasses having custom serializers.
fatkodima
Action Mailer
Action Cable
Active Storage
Fix N+1 query when fetching preview images for non-image assets.
Aaron Patterson & Justin Searls
Fix all Active Storage database related models to respect
ActiveRecord::Base.table_name_prefixconfiguration.Chedli Bourguiba
Fix
ActiveStorage::Representations::ProxyControllernot returning the properpreview image variant for previewable files.
Chedli Bourguiba
Fix
ActiveStorage::Representations::ProxyControllerto proxy untrackedvariants.
Chedli Bourguiba
Fix direct upload forms when submit button contains nested elements.
Marc Köhlbrugge
When using the
preprocessed: trueoption, avoid enqueuing transform jobsfor blobs that are not representable.
Chedli Bourguiba
Process preview image variant when calling
ActiveStorage::Preview#processed.For example,
attached_pdf.preview(:thumb).processedwill now immediatelygenerate the full-sized preview image and the
:thumbvariant of it.Previously, the
:thumbvariant would not be generated until a further callto e.g.
processed.url.Chedli Bourguiba and Jonathan Hefner
Prevent
ActiveRecord::StrictLoadingViolationErrorwhen strict loading isenabled and the variant of an Active Storage preview has already been
processed (for example, by calling
ActiveStorage::Preview#url).Jonathan Hefner
Fix
preprocessed: trueoption for named variants of previewable files.Nico Wenterodt
Action Mailbox
Action Text
Railties
Make sure
config.after_routes_loadedhook runs on boot.Rafael Mendonça França
Fix
config.log_levelnot being respected when using aBroadcastLoggerÉdouard Chin
Fix isolated engines to take
ActiveRecord::Base.table_name_prefixinto consideration.This will allow for engine defined models, such as inside Active Storage, to respect
Active Record table name prefix configuration.
Chedli Bourguiba
The
bin/rails app:templatecommand will no longer add potentially unwantedgem platforms via
bundle lock --add-platform=...commands.Jonathan Hefner
v7.1.2: 7.1.2Compare Source
Active Support
Fix
:expires_inoption forRedisCacheStore#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#fetchblock.Yasha Krasnou
Fix missing
requireresulting inNoMethodErrorwhen runningbin/rails secrets:showorbin/rails secrets:edit.Stephen Ierodiaconou
Ensure
{down,up}case_firstreturns non-frozen string.Jonathan Hefner
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
ActiveSupport::Cacheto 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#digfor array indexes.fatkodima
Fix time travel helpers to work when nested using with separate classes.
fatkodima
Fix
delete_matchedfor file cache store to work with keys longer than themax filename size.
fatkodima and Jonathan Hefner
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
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 whenfieldis a serialized attribute(for example, when
fieldusesActiveRecord::Base.serializeor is a JSONcolumn).
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_namenow returnsnilinstead of raising"undefined method
abstract_class?for Object:Class".a5-stable
Fix upserting for custom
:on_duplicateand:unique_byconsisting of allinserts keys.
fatkodima
Fixed an issue where saving a
record could innappropriately
dupits attributes.Jonathan Hefner
Dump schema only for a specific db for rollback/up/down tasks for multiple dbs.
fatkodima
Fix
NoMethodErrorwhen casting a PostgreSQLmoneyvalue that uses acomma 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
enumwith non-column-backed attributes.Non-column-backed attributes must be previously declared with an explicit
type. For example:
Jonathan Hefner
Raise on
foreign_key:being passed as an array in associationsNikita Vasilevsky
Return back maximum allowed PostgreSQL table name to 63 characters.
fatkodima
Fix detecting
IDENTITYcolumns for PostgreSQL < 10.fatkodima
Action View
Fix the
number_to_human_sizeview 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/ujscallingstart()an extra time when using bundlersHartley McGuire, Ryunosuke Sato
Fix the
captureview helper compatibility with HAML and SlimWhen 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 - chromedrivererror with parallel system tests
Matt Brictson
Fix
StrongParameters#extract_valueto include blank valuesOtherwise composite parameters may not be parsed correctly when one of the
component is blank.
fatkodima, Yasha Krasnou, Matthias Eiglsperger
Add
raccas a dependency since it will become a bundled gem in Ruby 3.4.0Hartley McGuire
Support handling Enumerator for non-buffered responses.
Zachary Scott
Active Job
Action Mailer
Action Cable
Active Storage
Action Mailbox
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:changewhen app has no Dockerfile.Hartley McGuire
If you accessed
config.eager_load_pathsand friends, later changes toconfig.pathswere not reflected in the expected auto/eager load paths.Now, they are.
This bug has been latent since Rails 3.
Fixes #49629.
Xavier Noria
v7.1.1: 7.1.1Compare Source
Active Support
Add support for keyword arguments when delegating calls to custom loggers from
ActiveSupport::BroadcastLogger.Jenny Shen
NumberHelper: handle objects respondingto_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
Active Record
Fix auto populating IDENTITY columns for PostgreSQL.
fatkodima
Fix "ArgumentError: wrong number of arguments (given 3, expected 2)" when
down migrating
rename_tablein 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/ujsfiles 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]
Ryunosuke Sato
Action Pack
Active Job
Don't log enqueuing details when the job wasn't enqueued.
Dustin Brown
Action Mailer
Action Cable
Active Storage
Action Mailbox
Action Text
Railties
Ensures the Rails generated Dockerfile uses correct ruby version and matches Gemfile.
Abhay Nikam
v7.1.0: 7.1.0Compare Source
Active Support
Fix
AS::MessagePackwithENV["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:
Adding other sink(s) to the broadcast:
Remove a sink from the broadcast:
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
bigdecimalas Active Support dependency that is a bundled gem candidate for Ruby 3.4.bigdecimal3.1.4 or higher version will be installed.Ruby 2.7 and 3.0 users who want
bigdecimalversion 2.0.0 or 3.0.0 behavior as a default gem,pin the
bigdecimalversion in your application Gemfile.Koichi ITO
Add
drb,mutex_mandbase64that are bundled gem candidates for Ruby 3.4Yasuo 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
#deletePreviously the
RedisCacheStore#deletewould return1if the entryexists and
0otherwise. Now it returns true if the entry exists and falseotherwise, just like the other stores.
The
FileStorewould returnnilif the entry doesn't exists and returnsfalsenow as well.Petrik de Heus
Active Support cache stores now support replacing the default compressor via
a
:compressoroption. The specified compressor must respond todeflateand
inflate. For example:compression logic...
decompression logic...
Active Support cache stores now support a
:serializeroption. Similar tothe
:coderoption, serializers must respond todumpandload. However,serializers are only responsible for serializing a cached value, whereas
coders are responsible for serializing the entire
ActiveSupport::Cache::Entryinstance. 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
:serializerand:coderoptions are mutually exclusive. Specifyingboth will raise an
ArgumentError.Jonathan Hefner
Fix
ActiveSupport::Inflector.humanize(nil)raisingNoMethodError: undefined method `end_with?' for nil:NilClass.James Robinson
Don't show secrets for
ActiveSupport::KeyGenerator#inspect.Before:
After:
Petrik de Heus
Improve error message when EventedFileUpdateChecker is used without a
compatible version of the Listen gem
Hartley McGuire
Add
:reportbehavior for DeprecationSetting
config.active_support.deprecation = :reportuses the errorreporter 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 compatibilityChristian Schmidt
Fix
EncryptedConfigurationreturning incorrect values for someHashmethods
Hartley McGuire
Don't show secrets for
MessageEncryptor#inspect.Before:
After:
Petrik de Heus
Don't show contents for
EncryptedConfiguration#inspect.Before:
After:
Petrik de Heus
ERB::Util.html_escape_oncealways returns anhtml_safestring.This method previously maintained the
html_safe?property of a string on the returnvalue. Because this string has been escaped, however, not marking it as
html_safecausesentities to be double-escaped.
As an example, take this view snippet:
Before this change, that would be double-escaped and render as:
After this change, it renders correctly as:
Fixes #48256
Mike Dalessio
Deprecate
SafeBuffer#clone_empty.This method has not been used internally since Rails 4.2.0.
Mike Dalessio
MessageEncryptor,MessageVerifier, andconfig.active_support.message_serializernow accept
:message_packand:message_pack_allow_marshalas serializers.These serializers require the
msgpackgem(>= 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:
BEFORE with config.active_support.message_serializer = :json
=> [{"a"=>1}, {"b"=>2}, "1.0", "1969-12-31T18:00:00.000-06:00"]
=> [Hash, Hash, String, String]
AFTER with config.active_support.message_serializer = :message_pack
=> [{:a=>1}, {"b"=>2}, 0.1e1, 1969-12-31 18:00:00.000123 -0600]
=> [Hash, ActiveSupport::HashWithIndifferentAccess, BigDecimal, Time]
A new
7.1cache format is available which includes an optimization forbare string values such as view fragments.
The
7.1cache format is used by default for new apps, and existing appscan enable the format by setting
config.load_defaults 7.1or by settingconfig.active_support.cache_format_version = 7.1inconfig/application.rbor a
config/environments/*.rbfile.Cache entries written using the
6.1or7.0cache formats can be readwhen using the
7.1format. To perform a rolling deploy of a Rails 7.1upgrade, 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.1cache format on a subsequent deploy.Jonathan Hefner
Active Support cache stores can now use a preconfigured serializer based on
ActiveSupport::MessagePackvia the:serializeroption:The
:message_packserializer can reduce cache entry sizes and improveperformance, but requires the
msgpackgem(>= 1.7.0).
The
:message_packserializer can read cache entries written by the defaultserializer, and the default serializer can now read entries written by the
:message_packserializer. These behaviors make it easy to migrate betweenserializer without invalidating the entire cache.
Jonathan Hefner
Object#deep_dupno longer duplicate named classes and modules.Before:
After:
Jean Boussier
Consistently raise an
ArgumentErrorif theActiveSupport::Cachekey is blank.Joshua Young
Deprecate usage of the singleton
ActiveSupport::Deprecation.All usage of
ActiveSupport::Deprecationas a singleton is deprecated, the most common one beingActiveSupport::Deprecation.warn. Gem authors should now create their own deprecator (ActiveSupport::Deprecationobject), and use it to emit deprecation warnings.
Calling any of the following without specifying a deprecator argument is also deprecated:
Use of
ActiveSupport::Deprecation.silenceand configuration methods likebehavior=,disallowed_behavior=,disallowed_warnings=should now be aimed at the application's deprecators.code that emits deprecation warnings
Add
Object#withto set and restore public attributes around a blockJean 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
StringbyActiveSupport::SafeBuffer.Rafael Mendonça França
Remove deprecated
active_support/core_ext/range/include_time_with_zonefile.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_sinArray,Range,Date,DateTime,Time,BigDecimal,Floatand,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::MemCacheStorewith an instance ofDalli::Client.Deprecate the undocumented option of providing an already-initialized instance of
Dalli::ClienttoActiveSupport::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()inTimeHelpers#travel_toInside the
travel_toblockTime.newis stubbedRaise
ActiveSupport::MessageEncryptor::InvalidMessagefromActiveSupport::MessageEncryptor#decrypt_and_verifyregardless of cipher.Previously, when a
MessageEncryptorwas using a non-AEAD cipher such asAES-256-CBC, a corrupt or tampered message would raise
ActiveSupport::MessageVerifier::InvalidSignature. Now, all ciphers raisethe same error:
=> raises ActiveSupport::MessageEncryptor::InvalidMessage
BEFORE:
=> raises ActiveSupport::MessageVerifier::InvalidSignature
AFTER:
=> raises ActiveSupport::MessageEncryptor::InvalidMessage
Support
niloriginal values when usingActiveSupport::MessageVerifier#verify.Previously,
MessageVerifier#verifydid not work withniloriginalvalues, though both
MessageVerifier#verifiedandMessageEncryptor#decrypt_and_verifydo:=> nil
=> nil
BEFORE:
=> raises ActiveSupport::MessageVerifier::InvalidSignature
AFTER:
=> nil
Maintain
html_safe?on html_safe strings when sliced withslice,slice!, orchrmethod.Previously,
html_safe?was only maintained when the html_safe strings were slicedwith
[]method. Now,slice,slice!, andchrmethods will maintainhtml_safe?like[]method.maintain html_safe? after the slice!
Add
Object#in?support for open ranges.Ignacio Galindo
config.i18n.raise_on_missing_translations = truenow raises on any missing translation.Previously it would only raise when called in a view or controller. Now it will raise
anytime
I18n.tis 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::CurrentAttributesnow raises if a restricted attribute name is used.Attributes such as
setandresetcannot be used as they clash with theCurrentAttributespublic API.Alex Ghiculescu
HashWithIndifferentAccess#transform_keysnow takes a Hash argument, justas Ruby's
Hash#transform_keysdoes.Akira Matsuda
delegatenow 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.
This defines 3.5 times faster method than before
This works but silently falls back to old behavior because
delegatecannot find the definition ofxassert_differencemessage now includes what changed.This makes it easier to debug non-obvious failures.
Before:
After:
Alex Ghiculescu
Add ability to match exception messages to
assert_raisesassertionInstead of this
you can now write this
fatkodima
Add
Rails.env.local?shorthand forRails.env.development? || Rails.env.test?.DHH
ActiveSupport::Testing::TimeHelpersnow accepts namedwith_usecargumentto
freeze_time,travel, andtravel_tomethods. Passing true preventstruncating the destination time with
change(usec: 0).KevSlashNull, and serprex
ActiveSupport::CurrentAttributes.resetsnow accepts a method nameThe block API is still the recommended approach, but now both APIs are supported:
Alex Ghiculescu
Ensure
ActiveSupport::Testing::Isolation::Forkingcloses pipesPreviously,
Forking.run_in_isolationopened two ends of a pipe. The forkprocess 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#changeandTime#advancefor times around the end of DaylightSaving Time.
Previously, when
Time#changeorTime#advanceconstructed a time insidethe final stretch of Daylight Saving Time (DST), the non-DST offset would
always be chosen for local times:
DST ended just before 2021-11-07 2:00:00 AM in US/Eastern.
=> 2021-11-07 01:00:00 -0400
=> 2021-11-07 01:00:00 -0500
=> 2021-11-07 01:00:00 -0500
=> 2021-11-06 01:00:00 -0400
=> 2021-11-07 01:00:00 -0500
=> 2021-11-07 01:00:00 -0500
=> 2021-11-07 01:00:00 -0500
=> 2021-11-07 01:00:00 -0400
=> 2021-11-07 01:00:00 -0400
=> 2021-11-08 01:00:00 -0500
=> 2021-11-07 01:00:00 -0400
=> 2021-11-07 01:00:00 -0400
=> 2021-11-07 01:00:00 -0400
=> 2021-11-07 01:00:00 -0400
=> 2021-11-07 01:00:00 -0400
=> 2021-11-06 01:00:00 -0400
=> 2021-11-07 01:00:00 -0400
=> 2021-11-07 01:00:00 -0400
=> 2021-11-07 01:00:00 -0500
=> 2021-11-07 01:00:00 -0500
=> 2021-11-07 01:00:00 -0500
=> 2021-11-08 01:00:00 -0500
=> 2021-11-07 01:00:00 -0500
=> 2021-11-07 01:00:00 -0500
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.handleandRails.error.recordfilter now by multiple error classes.Martin Spickermann
Class#subclassesandClass#descendantsnow 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#subclassesandDescendantTracker#descendants.Jean Boussier
Rails.error.reportnow 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_reportedandassert_no_error_reportedAllows to easily asserts an error happened but was handled
...
ActiveSupport::Deprecationbehavior callbacks can now receive thedeprecator 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
debugflag.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_warningsnow affects the instance onwhich it is configured.
This means that individual
ActiveSupport::Deprecationinstances can beconfigured with their own disallowed warnings, and the global
ActiveSupport::Deprecation.disallowed_warningsnow only affects the globalActiveSupport::Deprecation.warn.Before
After
Note that global
ActiveSupport::Deprecationmethods such asActiveSupport::Deprecation.warnand
ActiveSupport::Deprecation.disallowed_warningshave been deprecated.Jonathan Hefner
Add italic and underline support to
ActiveSupport::LogSubscriber#colorPreviously, only bold text was supported via a positional argument.
This allows for bold, italic, and underline options to be specified
for colored logs.
Gannon McGibbon
Add
String#downcase_firstmethod.This method is the corollary of
String#upcase_first.Mark Schneider
thread_mattr_accessorwill call.dup.freezeon 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_timeconfig toActiveSupport::Cache::StoreSpecifies if an
ArgumentErrorshould be raised ifRails.cachefetchorwriteare given an invalidexpires_atorexpires_intime.Options are
true, andfalse. Iffalse, the exception will be reportedas
handledand logged instead. Defaults totrueifconfig.load_defaults >= 7.1.Trevor Turk
ActiveSupport::Cache:Store#fetchnow passes an options accessor to the block.It makes possible to override cache options:
set cache's TTL to match token's TTL
defaultoption ofthread_mattr_accessornow applies through inheritance andalso across new threads.
Previously, the
defaultvalue provided was set only at the moment of definingthe attribute writer, which would cause the attribute to be uninitialized in
descendants and in other threads.
Fixes #43312.
Thierry Deo
Redis cache store is now compatible with redis-rb 5.0.
Jean Boussier
Add
skip_nil:support toActiveSupport::Cache::Store#fetch_multi.Daniel Alfaro
Add
quartermethod to date/timeMatt Swanson
Fix
NoMethodErroron customActiveSupport::Deprecationbehavior.ActiveSupport::Deprecation.behavior=was supposed to accept any objectthat responds to
call, but in fact its internal implementation assumed thatthis object could respond to
arity, so it was restricted to onlyProcobjects.This change removes this
arityrestriction of custom behaviors.Ryo Nakamura
Support
:url_safeoption forMessageEncryptor.The
MessageEncryptorconstructor now accepts a:url_safeoption, similarto the
MessageVerifierconstructor. When enabled, this option ensuresthat messages use a URL-safe encoding.
Jonathan Hefner
Add
url_safeoption toActiveSupport::MessageVerifierinitializerActiveSupport::MessageVerifier.newnow takes optionalurl_safeargument.It can generate URL-safe strings by passing
url_safe: true.This option is
falseby default to be backwards compatible.Shouichi Kamiya
Enable connection pooling by default for
MemCacheStoreandRedisCacheStore.If you want to disable connection pooling, set
:pooloption tofalsewhen configuring the cache store:fatkodima
Add
force:support toActiveSupport::Cache::Store#fetch_multi.fatkodima
Deprecated
:pool_sizeand:pool_timeoutoptions for configuring connection pooling in cache stores.Use
pool: trueto enable pooling with default settings:Or pass individual options via
:pooloption:fatkodima
Allow #increment and #decrement methods of
ActiveSupport::Cache::Storesubclasses 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 toRedisCacheStoreJoey Paris
ActiveSupport::Cache::MemoryStore#write(name, val, unless_exist:true)nowcorrectly writes expired keys.
Alan Savage
ActiveSupport::ErrorReporternow accepts and forward asource: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::HelpersandERB::Util.Add the method
ERB::Util.xml_name_escapeto escape dangerous charactersin names of tags and names of attributes, following the specification of XML.
Álvaro Martín Fraguas
Respect
ActiveSupport::Logger.new's:formatterkeyword argumentThe stdlib
Logger::newallows passing a:formatterkeyword argument toset the logger's formatter. Previously
ActiveSupport::Logger.newignoredthat 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_timeWith 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
falseas that is the only scenario where theremoval of the compatibility layer has any effect.
Andrew White
Pathname.blank?only returns true forPathname.new("")Previously it would end up calling
Pathname#empty?which returned trueif the path existed and was an empty directory or file.
That behavior was unlikely to be expected.
Jean Boussier
Deprecate
Notification::Event's#childrenand#parent_of?John Hawthorn
Change the default serializer of
ActiveSupport::MessageVerifierfromMarshaltoActiveSupport::JSONwhen usingconfig.load_defaults 7.1.Messages serialized with
Marshalcan still be read, but new messages willbe serialized with
ActiveSupport::JSON. For more information, seehttps://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::MessageEncryptorfromMarshaltoActiveSupport::JSONwhen usingconfig.load_defaults 7.1.Messages serialized with
Marshalcan still be read, but new messages willbe serialized with
ActiveSupport::JSON. For more information, seehttps://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer.
Zack Deveau, Martin Gingras, and Jonathan Hefner
Add
ActiveSupport::TestCase#stub_constto stub a constant for the duration of a yield.DHH
Fix
ActiveSupport::EncryptedConfigurationto be compatible with Psych 4Stephen Sugden
Improve
File.atomic_writeerror handlingDaniel Pepper
Fix
Class#descendantsandDescendantsTracker#descendantscompatibility with Ruby 3.1.The native
Class#descendantswas reverted prior to Ruby 3.1 release,but
Class#subclasseswas 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_keyto_keyavoids wrapping#idvalue into anArrayif#idalready an arrayNikita Vasilevsky
Add
ActiveModel::Conversion.param_delimiterto configure delimiter being used into_paramNikita Vasilevsky
undefine_attribute_methodsundefines 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(namedactive_model) to match the load hook forActiveRecord::Baseand allow for overriding aspects of theActiveModel::Modelclass.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.
ChatGPT, Guillermo Iguaran
has_secure_passwordnow generates an#{attribute}_saltmethod that returns the saltused 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: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::MissingAttributeErrorerror message.Show which class is missing the attribute in the error message:
=> ActiveModel::MissingAttributeError: missing attribute 'user_id' for Pet
Raise
NoMethodErrorinActiveModel::Type::Value#as_jsonto avoid unpredictableresults.
Vasiliy Ermolovich
Custom attribute types that inherit from Active Model built-in types and do
not override the
serializemethod will now benefit from an optimizationwhen serializing attribute values for the database.
For example, with a custom type like the following:
Serializing the
emailattribute for the database will be roughly twice asfast. More expensive
castoperations will likely see greater improvements.Jonathan Hefner
has_secure_passwordnow supports password challenges via apassword_challengeaccessor 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_challengeis set, the validation checks that the value'sdigest matches the currently persisted
password_digest(i.e.password_digest_was).This allows a password challenge to be done as part of a typical
updatecall, 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:
...
...
Support infinite ranges for
LengthValidators:in/:withinoptionsfatkodima
Add support for beginless ranges to inclusivity/exclusivity validators:
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.
This PR has been generated by Mend Renovate. View repository job log here.