v7.0.4
版本发布时间: 2022-09-10 03:17:17
rails/rails最新发布版本:v7.2.0.beta3(2024-07-12 00:05:58)
Active Support
-
Redis cache store is now compatible with redis-rb 5.0.
Jean Boussier
-
Fix
NoMethodError
on customActiveSupport::Deprecation
behavior.ActiveSupport::Deprecation.behavior=
was supposed to accept any object that responds tocall
, but in fact its internal implementation assumed that this object could respond toarity
, so it was restricted to onlyProc
objects.This change removes this
arity
restriction of custom behaviors.Ryo Nakamura
Active Model
-
Handle name clashes in attribute methods code generation cache.
When two distinct attribute methods would generate similar names, the first implementation would be incorrectly re-used.
class A attribute_method_suffix "_changed?" define_attribute_methods :x end class B attribute_method_suffix "?" define_attribute_methods :x_changed end
Jean Boussier
Active Record
-
Symbol is allowed by default for YAML columns
Étienne Barrié
-
Fix
ActiveRecord::Store
to serialize as a regular HashPreviously it would serialize as an
ActiveSupport::HashWithIndifferentAccess
which is wasteful and cause problem with YAML safe_load.Jean Boussier
-
Add
timestamptz
as a time zone aware type for PostgreSQLThis is required for correctly parsing
timestamp with time zone
values in your database.If you don't want this, you can opt out by adding this initializer:
ActiveRecord::Base.time_zone_aware_types -= [:timestamptz]
Alex Ghiculescu
-
Fix supporting timezone awareness for
tsrange
andtstzrange
array columns.# In database migrations add_column :shops, :open_hours, :tsrange, array: true # In app config ActiveRecord::Base.time_zone_aware_types += [:tsrange] # In the code times are properly converted to app time zone Shop.create!(open_hours: [Time.current..8.hour.from_now])
Wojciech Wnętrzak
-
Resolve issue where a relation cache_version could be left stale.
Previously, when
reset
was called on a relation object it did not reset the cache_versions ivar. This led to a confusing situation where despite having the correct data the relation still reported a stale cache_version.Usage:
developers = Developer.all developers.cache_version Developer.update_all(updated_at: Time.now.utc + 1.second) developers.cache_version # Stale cache_version developers.reset developers.cache_version # Returns the current correct cache_version
Fixes #45341.
Austen Madden
-
Fix
load_async
when called on an association proxy.Calling
load_async
directly an association would schedule a query but never use it.comments = post.comments.load_async # schedule a query comments.to_a # perform an entirely new sync query
Now it does use the async query, however note that it doesn't cause the association to be loaded.
Jean Boussier
-
Fix eager loading for models without primary keys.
Anmol Chopra, Matt Lawrence, and Jonathan Hefner
-
rails db:schema:{dump,load}
now checksENV["SCHEMA_FORMAT"]
before configSince
rails db:structure:{dump,load}
was deprecated there wasn't a simple way to dump a schema to both SQL and Ruby formats. You can now do this with an environment variable. For example:SCHEMA_FORMAT=sql rake db:schema:dump
Alex Ghiculescu
-
Fix Hstore deserialize regression.
edsharp
Action View
-
Guard against
ActionView::Helpers::FormTagHelper#field_name
calls with nilobject_name
arguments. For example:<%= fields do |f| %> <%= f.field_name :body %> <% end %>
Sean Doyle
-
Strings returned from
strip_tags
are correctly taggedhtml_safe?
Because these strings contain no HTML elements and the basic entities are escaped, they are safe to be included as-is as PCDATA in HTML content. Tagging them as html-safe avoids double-escaping entities when being concatenated to a SafeBuffer during rendering.
Fixes rails/rails-html-sanitizer#124
Mike Dalessio
Action Pack
-
Prevent
ActionDispatch::ServerTiming
from overwriting existing values inServer-Timing
.Previously, if another middleware down the chain set
Server-Timing
header, it would overwritten byActionDispatch::ServerTiming
.Jakub Malinowski
Active Job
-
Update
ActiveJob::QueueAdapters::QueAdapter
to remove deprecation warning.Remove a deprecation warning introduced in que 1.2 to prepare for changes in que 2.0 necessary for Ruby 3 compatibility.
Damir Zekic and Adis Hasovic
Action Mailer
- No changes.
Action Cable
-
The Redis adapter is now compatible with redis-rb 5.0
Compatibility with redis-rb 3.x was dropped.
Jean Boussier
-
The Action Cable server is now mounted with
anchor: true
.This means that routes that also start with
/cable
will no longer clash with Action Cable.Alex Ghiculescu
Active Storage
-
Fixes proxy downloads of files over 5MiB
Previously, trying to view and/or download files larger than 5mb stored in services like S3 via proxy mode could return corrupted files at around 5.2mb or cause random halts in the download. Now,
ActiveStorage::Blobs::ProxyController
correctly handles streaming these larger files from the service to the client without any issues.Fixes #44679
Felipe Raul
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
-
config.allow_concurrency = false
now use aMonitor
instead of aMutex
This allows to enable
config.active_support.executor_around_test_case
even whenconfig.allow_concurrency
is disabled.Jean Boussier
-
Skip Active Storage and Action Mailer if Active Job is skipped.
Étienne Barrié
-
Correctly check if frameworks are disabled when running app:update.
Étienne Barrié and Paulo Barros
-
Fixed
config.active_support.cache_format_version
never being applied.Rails 7.0 shipped with a new serializer for Rails.cache, but the associated config wasn't working properly. Note that even after this fix, it can only be applied from the
application.rb
file.Alex Ghiculescu