Releases: rails/rails
v7.1.3.2
Active Support
- No changes.
Active Model
- No changes.
Active Record
- No changes.
Action View
- No changes.
Action Pack
- Fix
raise_on_missing_translations
not working correctly with the
translate
method in controllers after the patch for CVE-2024-26143.
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.
7.1.3.1
Active Support
- No changes.
Active Model
- No changes.
Active Record
- No changes.
Action View
- No changes.
Action Pack
-
Fix possible XSS vulnerability with the
translate
method in controllers -
Fix ReDoS in Accept header parsing
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.
7.0.8.1
Active Support
- No changes.
Active Model
- No changes.
Active Record
- No changes.
Action View
- No changes.
Action Pack
-
Fix possible XSS vulnerability with the
translate
method in controllers
Active Job
- No changes.
Action Mailer
- No changes.
Action Cable
- No changes.
Active Storage
-
Disables the session in
ActiveStorage::Blobs::ProxyController
andActiveStorage::Representations::ProxyController
in order to allow caching by default in some CDNs as CloudFlareFixes #44136
Bruno Prieto
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
- No changes.
6.1.7.7
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
- No changes.
Action Cable
- No changes.
Active Storage
-
Disables the session in
ActiveStorage::Blobs::ProxyController
andActiveStorage::Representations::ProxyController
in order to allow caching by default in some CDNs as CloudFlareFixes #44136
Bruno Prieto
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
- No changes.
7.1.3
Active Support
-
Handle nil
backtrace_locations
inActiveSupport::SyntaxErrorProxy
.Eugene Kenny
-
Fix
ActiveSupport::JSON.encode
to 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_multi
when using a cache namespace
and local cache strategy.Mark Oleson
-
Fix
Time.now/DateTime.now/Date.today
to 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_exist
option forMemoryStore#write
(et al) when using a
cache namespace.S. Brent Faulkner
-
Fix ActiveSupport::Deprecation to handle blaming generated code.
Jean Boussier, fatkodima
Active Model
- No changes.
Active Record
-
Fix Migrations with versions older than 7.1 validating options given to
add_reference
.Hartley McGuire
-
Ensure
reload
sets correct owner for each association.Dmytro Savochkin
-
Fix view runtime for controllers with async queries.
fatkodima
-
Fix
load_async
to work with query cache.fatkodima
-
Fix polymorphic
belongs_to
to correctly use parent'squery_constraints
.fatkodima
-
Fix
Preloader
to 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_by
to 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_count
could return a raw integer rather than a Promise
if it found the result in the query cache.fatkodima
-
Fix
Relation#transaction
to not apply a default scope.The method was incorrectly setting a default scope around its block:
Post.where(published: true).transaction do Post.count # SELECT COUNT(*) FROM posts WHERE published = FALSE; end
Jean Boussier
-
Fix calling
async_pluck
on anone
relation.Model.none.async_pluck(:id)
was returning a naked value
instead of a promise.Jean Boussier
-
Fix calling
load_async
on anone
relation.Model.none.load_async
was returning a broken result.Lucas Mazza
-
TrilogyAdapter: ignore
host
ifsocket
parameter is set.This allows to configure a connection on a UNIX socket via DATABASE_URL:
DATABASE_URL=trilogy://does-not-matter/my_db_production?socket=/var/run/mysql.sock
Jean Boussier
-
Fix
has_secure_token
calls the setter method on initialize.Abeid Ahmed
-
Allow using
object_id
as a database column name.
It was available before rails 7.1 and may be used as a part of polymorphic relationship toobject
whereobject
can be any other database record.Mikhail Doronin
-
Fix
rails db:create:all
to not touch databases before they are created.fatkodima
Action View
-
Better handle SyntaxError in Action View.
Mario Caropreso
-
Fix
word_wrap
with empty string.Jonathan Hefner
-
Rename
ActionView::TestCase::Behavior::Content
toActionView::TestCase::Behavior::RenderedViewContent
.Make
RenderedViewContent
inherit fromString
. Make private API with:nodoc:
.Sean Doyle
-
Fix detection of required strict locals.
Further fix
render @collection
compatibility with strict localsJean Boussier
Action Pack
-
Fix including
Rails.application.routes.url_helpers
directly in an
ActiveSupport::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::Base
when loadingActiveJob::TestHelper
.Maxime Réty
-
Preserve the serialized timezone when deserializing
ActiveSupport::TimeWithZone
arguments.Joshua Young
-
Fix ActiveJob arguments serialization to correctly serialize String subclasses having custom serializers.
fatkodima
Action Mailer
- No changes.
Action Cable
- No changes.
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_prefix
configuration.Chedli Bourguiba
-
Fix
ActiveStorage::Representations::ProxyController
not returning the proper
preview image variant for previewable files.Chedli Bourguiba
-
Fix
ActiveStorage::Representations::ProxyController
to proxy untracked
variants.Chedli Bourguiba
-
Fix direct upload forms when submit button contains nested elements.
Marc Köhlbrugge
-
When using the
preprocessed: true
option, avoid enqueuing transform jobs
for blobs that are not representable.Chedli Bourguiba
-
Process preview image variant when calling
ActiveStorage::Preview#processed
.
For example,attached_pdf.preview(:thumb).processed
will now immediately
generate the full-sized preview image and the:thumb
variant of it.
Previously, the:thumb
variant would not be generated until a further call
to e.g.processed.url
.Chedli Bourguiba and Jonathan Hefner
-
Prevent
ActiveRecord::StrictLoadingViolationError
when strict loading is
enabled and the variant of an Active Storage preview has already been
processed (for example, by callingActiveStorage::Preview#url
).Jonathan Hefner
-
Fix
preprocessed: true
option for named variants of previewable files.Nico Wenterodt
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
-
Make sure
config.after_routes_loaded
hook runs on boot.Rafael Mendonça França
-
Fix
config.log_level
not being respected when using aBroadcastLogger
Édouard Chin
-
Fix isolated engines to take
ActiveRecord::Base.table_name_prefix
into 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:template
command will no longer add potentially unwanted
gem platforms viabundle lock --add-platform=...
commands.Jonathan Hefner
7.1.2
Active Support
-
Fix
:expires_in
option 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 aActiveSupport::Cache::Store#fetch
block.Yasha Krasnou
-
Fix missing
require
resulting inNoMethodError
when running
bin/rails secrets:show
orbin/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'sbroadcasts
.Andrew Novoselac
-
Fix issue where
bootstrap.rb
overwrites thelevel
of aBroadcastLogger
'sbroadcasts
.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 stdlibLogger#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 whenfield
is a serialized attribute
(for example, whenfield
usesActiveRecord::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 returnsnil
instead of raising
"undefined methodabstract_class?
for Object:Class".a5-stable
-
Fix upserting for custom
:on_duplicate
and:unique_by
consisting of all
inserts keys.fatkodima
-
Fixed an issue where saving a
record could innappropriatelydup
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 PostgreSQLmoney
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: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 associationsNikita 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
callingstart()
an extra time when using bundlersHartley McGuire, Ryunosuke Sato
-
Fix the
capture
view 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 - chromedriver
error with parallel system testsMatt Brictson
-
Fix
StrongParameters#extract_value
to include blank valuesOtherwise 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.0Hartley 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.
Xavier Noria
7.1.1
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
- No changes.
Active Record
-
Fix auto populating IDENTITY columns for PostgreSQL.
fatkodima
-
Fix "ArgumentError: wrong number of arguments (given 3, expected 2)" when
down migratingrename_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]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
7.1.0
Active Support
-
Fix
AS::MessagePack
withENV["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:
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:
broadcast = ActiveSupport::BroadcastLogger.new broadcast.broadcast_to(Logger.new(STDERR))
Remove a sink from the broadcast:
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 wantbigdecimal
version 2.0.0 or 3.0.0 behavior as a default gem,
pin thebigdecimal
version in your application Gemfile.Koichi ITO
-
Add
drb
,mutex_m
andbase64
that 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
#delete
Previously the
RedisCacheStore#delete
would return1
if the entry
exists and0
otherwise. Now it returns true if the entry exists and false
otherwise, just like the other stores.The
FileStore
would returnnil
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 todeflate
andinflate
. For example: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 todump
andload
. However,
serializers are only responsible for serializing a cached value, whereas
coders are responsible for serializing the entireActiveSupport::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 anArgumentError
.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:
ActiveSupport::KeyGenerator.new(secret).inspect "#<ActiveSupport::KeyGenerator:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
After:
ActiveSupport::KeyGenerator::Aes256Gcm(secret).inspect "#<ActiveSupport::KeyGenerator:0x0000000104888038>"
Petrik de Heus
-
Improve error message when EventedFileUpdateChecker is used without a
compatible version of the Listen gemHartley McGuire
-
Add
:report
behavior for DeprecationSetting
config.active_support.deprecation = :report
uses the error
reporter to report deprecation warnings toActiveSupport::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
EncryptedConfiguration
returning incorrect values for someHash
methodsHartley McGuire
-
Don't show secrets for
MessageEncryptor#inspect
.Before:
ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect "#<ActiveSupport::MessageEncryptor:0x0000000104888038 ... @secret=\"\\xAF\\bFh]LV}q\\nl\\xB2U\\xB3 ... >"
After:
ActiveSupport::MessageEncryptor.new(secret, cipher: "aes-256-gcm").inspect "#<ActiveSupport::MessageEncryptor:0x0000000104888038>"
Petrik de Heus
-
Don't show contents for
EncryptedConfiguration#inspect
.Before:
Rails.application.credentials.inspect "#<ActiveSupport::EncryptedConfiguration:0x000000010d2b38e8 ... @config={:secret=>\"something secret\"} ... @key_file_contents=\"915e4ea054e011022398dc242\" ...>"
After:
Rails.application.credentials.inspect "#<ActiveSupport::EncryptedConfiguration:0x000000010d2b38e8>"
Petrik de Heus
-
ERB::Util.html_escape_once
always returns anhtml_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 ashtml_safe
causes
entities to be double-escaped.As an example, take this view snippet:
<p><%= html_escape_once("this & that & the other") %></p>
Before this change, that would be double-escaped and render as:
<p>this &amp; that &amp; the other</p>
After this change, it renders correctly as:
<p>this & that & the other</p>
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_serializer
now accept:message_pack
and:message_pack_allow_marshal
as serializers.
These serializers require themsgpack
gem
(>= 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: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 withMarshal
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 settingconfig.load_defaults 7.1
or by setting
config.active_support.cache_format_version = 7.1
inconfig/application.rb
or aconfig/environments/*.rb
file.Cache entries written using the
6.1
or7.0
cache formats can be read
when using the7.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 the7.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:config.cache_store = :redis_cache_store, { serializer: :message_pack }
The
:message_pack
serializer can reduce cache entry sizes and improve
perf...
7.1.0.rc2
Active Support
-
Fix
AS::MessagePack
withENV["RAILS_MAX_THREADS"]
.Jonathan Hefner
Active Model
- No changes.
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
Action View
- No changes.
Action Pack
- No changes.
Active Job
-
Make sure
scheduled_at
is a Time object when asserting enqueued jobs.Rafael Mendonça França
Action Mailer
- No changes.
Action Cable
- No changes.
Active Storage
- No changes.
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
-
Always set the Rails logger to be an instance of
ActiveSupport::BroadcastLogger
.Edouard Chin
7.1.0.rc1
Active Support
-
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:
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:
broadcast = ActiveSupport::BroadcastLogger.new broadcast.broadcast_to(Logger.new(STDERR))
Remove a sink from the broadcast:
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
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
Active Record
-
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:
add_unique_key :sections, [:position], deferrable: :deferred, name: "unique_section_position" remove_unique_key :sections, name: "unique_section_position"
Now:
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.
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 ofretries
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 simplebusy_handler
function to retry busy connections without exponential backoff up to the max number ofretries
.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) as well as custom primary keys.Stephen Margheim
-
Ensure the SQLite3 adapter handles default functions with the
||
concatenation operatorPreviously, this default function would produce the static string
"'Ruby ' || 'on ' || 'Rails'"
.
Now, the adapter will appropriately receive and use"Ruby on Rails"
.change_column_default "test_models", "ruby_on_rails", -> { "('Ruby ' || 'on ' || 'Rails')" }
Stephen Margheim
-
Dump PostgreSQL schemas as part of the schema dump.
Lachlan Sylvester
Action View
-
Introduce
ActionView::TestCase.register_parser
register_parser :rss, -> rendered { RSS::Parser.parse(rendered) } test "renders RSS" do article = Article.create!(title: "Hello, world") render formats: :rss, partial: article assert_equal "Hello, world", rendered.rss.items.last.title end
By default, register parsers for
:html
and:json
.Sean Doyle
Action Pack
-
Add support for
#deep_merge
and#deep_merge!
to
ActionController::Parameters
.Sean Doyle
Active Job
-
Set
scheduled_at
attribute as a Time object instead of epoch seconds, and serialize and deserialize the value
when enqueued. Assigning a numeric/epoch value to scheduled_at= is deprecated; use a Time object instead.Deserializes
enqueued_at
as a Time instead of ISO8601 String.Ben Sheldon
-
Clarify the backoff strategy for the recommended
:wait
option when retrying jobswait: :exponentially_longer
is waiting polynomially longer, so it is now recommended to usewait: :polynomially_longer
to keep the same behavior.Victor Mours
Action Mailer
-
Introduce
ActionMailer::FormBuilder
Use the
default_form_builder
method in mailers to set the default form builder
for templates rendered by that mailer. Matches the behaviour in Action Controller.Alex Ghiculescu
Action Cable
- No changes.
Active Storage
-
Add
expires_at
option toActiveStorage::Blob#signed_id
.rails_blob_path(user.avatar, disposition: "attachment", expires_at: 30.minutes.from_now) <%= image_tag rails_blob_path(user.avatar.variant(resize: "100x100"), expires_at: 30.minutes.from_now) %>
Aki
-
Allow attaching File and Pathname when assigning attributes, e.g.
User.create!(avatar: File.open("image.jpg")) User.create!(avatar: file_fixture("image.jpg"))
Dorian Marié
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
-
Require
concurrent-ruby
inconfig/puma.rb
so that Puma can boot in
production whenWEB_CONCURRENCY
is not explicitly specified.Fixes #49323.
Matt Brictson
-
Raise error when generating attribute with dangerous name.
The following will now raise an error as
save
andhash
are already
defined by Active Record.$ bin/rails generate model Post save $ bin/rails generate model Post hash
Petrik de Heus