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