registry
registry copied to clipboard
chore(deps): update dependency rails to v8
This PR contains the following updates:
| Package | Change | Age | Confidence |
|---|---|---|---|
| rails (source, changelog) | '~> 6.1.4' -> '~> 8.0.0' |
Release Notes
rails/rails (rails)
v8.0.2.1: 8.0.2.1
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.
v8.0.2: 8.0.2
Active Support
-
Fix setting
to_time_preserves_timezonefromnew_framework_defaults_8_0.rb.fatkodima
-
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
Active Model
- No changes.
Active Record
-
Fix inverting
rename_enum_valuewhen:from/:toare provided.fatkodima
-
Prevent persisting invalid record.
Edouard Chin
-
Fix inverting
drop_tablewithout options.fatkodima
-
Fix count with group by qualified name on loaded relation.
Ryuta Kamizono
-
Fix
sumwith qualified name on loaded relation.Chris Gunther
-
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
-
PoolConfig no longer keeps a reference to the connection class.
Keeping a reference to the class caused subtle issues when combined with reloading in development. Fixes #54343.
Mike Dalessio
-
Fix SQL notifications sometimes not sent when using async queries.
Post.async_count ActiveSupport::Notifications.subscribed(->(*) { "Will never reach here" }) do Post.count endIn rare circumstances and under the right race condition, Active Support notifications would no longer be dispatched after using an asynchronous query. This is now fixed.
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 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
Action View
-
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
Action Pack
-
Improve
with_routingtest helper to not rebuild the middleware stack.Otherwise some middleware configuration could be lost.
Édouard Chin
-
Add resource name to the
ArgumentErrorthat's raised when invalid:onlyor:exceptoptions are given to#resourceor#resourcesThis makes it easier to locate the source of the problem, especially for routes drawn by gems.
Before:
:only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]After:
Route `resources :products` - :only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]Jeremy Green
-
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
Active Job
- No changes.
Action Mailer
- No changes.
Action Cable
- No changes.
Active Storage
-
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
-
Fix Rails console to load routes.
Otherwise
*_pathand*urlmethods are missing on theappobject.Édouard Chin
-
Update
rails new --minimaloptionExtend the
--minimalflag to exclude recently added features:skip_brakeman,skip_ci,skip_docker,skip_kamal,skip_rubocop,skip_solidandskip_thruster.eelcoj
-
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.
v8.0.1: 8.0.1
Active Support
-
Fix a bug in
ERB::Util.tokenizethat causes incorrect tokenization when ERB tags are preceeded by multibyte characters.Martin Emde
-
Restore the ability to decorate methods generated by
class_attribute.It always has been complicated to use Module#prepend or an alias method chain to decorate methods defined by
class_attribute, but became even harder in 8.0.This capability is now supported for both reader and writer methods.
Jean Boussier
Active Model
- No changes.
Active Record
-
Fix removing foreign keys with :restrict action for MySQ
fatkodima
-
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_keyto be revertible when given invalid options.fatkodima
-
Fix asynchronous destroying of polymorphic
belongs_toassociations.fatkodima
-
Fix
insert_allto not update existing records.fatkodima
-
NOT VALIDconstraints should not dump increate_table.Ryuta Kamizono
-
Fix finding by nil composite primary key association.
fatkodima
-
Properly reset composite primary key configuration when setting a primary key.
fatkodima
-
Fix Mysql2Adapter support for prepared statements
Using prepared statements with MySQL could result in a
NoMethodErrorexception.Jean Boussier, Leo Arnold, zzak
-
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
-
Fix
sumwhen performing a grouped calculation.User.group(:friendly).sumno longer worked. This is fixed.Edouard Chin
-
Restore back the ability to pass only database name to
DATABASE_URL.fatkodima
Action View
-
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
-
Add
ActionDispatch::Request::Session#storemethod to conform Rack spec.Yaroslav
Active Job
-
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
-
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
- No changes.
Action Mailbox
- No changes.
Action Text
- No changes.
Railties
-
Skip generation system tests related code for CI when
--skip-system-testis given.fatkodima
-
Don't add bin/thrust if thruster is not in Gemfile.
Étienne Barrié
-
Don't install a package for system test when applications don't use it.
y-yagi
Guides
- No changes.
v8.0.0.1: 8.0.0.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.
v8.0.0: 8.0.0
Active Support
-
Remove deprecated support to passing an array of strings to
ActiveSupport::Deprecation#warn.Rafael Mendonça França
-
Remove deprecated support to setting
attr_internal_naming_formatwith a@prefix.Rafael Mendonça França
-
Remove deprecated
ActiveSupport::ProxyObject.Rafael Mendonça França
-
Don't execute i18n watcher on boot. It shouldn't catch any file changes initially, and unnecessarily slows down boot of applications with lots of translations.
Gannon McGibbon, David Stosik
-
Fix
ActiveSupport::HashWithIndifferentAccess#stringify_keysto stringify all keys not just symbols.Previously:
{ 1 => 2 }.with_indifferent_access.stringify_keys[1] # => 2After this change:
{ 1 => 2 }.with_indifferent_access.stringify_keys["1"] # => 2This change can be seen as a bug fix, but since it behaved like this for a very long time, we're deciding to not backport the fix and to make the change in a major release.
Jean Boussier
-
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
-
Deprecate
Benchmark.mscore extension.The
benchmarkgem will become bundled in Ruby 3.5Earlopain
-
ActiveSupport::TimeWithZone#inspectnow uses ISO 8601 style time likeTime#inspectJohn Hawthorn
-
ActiveSupport::ErrorReporter#reportnow assigns a backtrace to unraised exceptions.Previously reporting an un-raised exception would result in an error report without a backtrace. Now it automatically generates one.
Jean Boussier
-
Add
escape_html_entitiesoption toActiveSupport::JSON.encode.This allows for overriding the global configuration found at
ActiveSupport.escape_html_entities_in_jsonfor specific calls toto_json.This should be usable from controllers in the following manner:
class MyController < ApplicationController def index render json: { hello: "world" }, escape_html_entities: false end endNigel Baillie
-
Raise when using key which can't respond to
#to_syminEncryptedConfiguration.As is the case when trying to use an Integer or Float as a key, which is unsupported.
zzak
-
Deprecate addition and since between two
TimeandActiveSupport::TimeWithZone.Previously adding time instances together such as
10.days.ago + 10.days.agoor10.days.ago.since(10.days.ago)produced a nonsensical future date. This behavior is deprecated and will be removed in Rails 8.1.Nick Schwaderer
-
Support rfc2822 format for Time#to_fs & Date#to_fs.
Akshay Birajdar
-
Optimize load time for
Railtie#initialize_i18n. FilterI18n.load_paths passed to the file watcher to only those underRails.root. Previously the watcher would grab all available locales, including those in gems which do not require a watcher because they won't change.Nick Schwaderer
-
Add a
filteroption toin_order_ofto prioritize certain values in the sorting without filtering the results by these values.Igor Depolli
-
Improve error message when using
assert_differenceorassert_changeswith a proc by printing the proc's source code (MRI only).Richard Böhme, Jean Boussier
-
Add a new configuration value
:zoneforActiveSupport.to_time_preserves_timezoneand rename the previoustruevalue to:offset. The new default value is:zone.Jason Kim, John Hawthorn
-
Align instrumentation
payload[:key]in ActiveSupport::Cache to follow the same pattern, with namespaced and normalized keys.Frederik Erbs Spang Thomsen
-
Fix
travel_toto set usec 0 whenwith_usecisfalseand the given argument String or DateTime.mopp
Active Model
-
Add
:except_onoption for validations. Grants the ability to skip validations in specified contexts.class User < ApplicationRecord #... validates :birthday, presence: { except_on: :admin } #... end user = User.new(attributes except birthday) user.save(context: :admin)Drew Bragg
-
Make
ActiveModel::Serialization#read_attribute_for_serializationpublicSean Doyle
-
Add a default token generator for password reset tokens when using
has_secure_password.class User < ApplicationRecord has_secure_password end user = User.create!(name: "david", password: "123", password_confirmation: "123") token = user.password_reset_token User.find_by_password_reset_token(token) # returns user
16 minutes later...
User.find_by_password_reset_token(token) # returns nil
raises ActiveSupport::MessageVerifier::InvalidSignature since the token is expired
User.find_by_password_reset_token!(token)
```
*DHH*
-
Add a load hook
active_model_translationforActiveModel::Translation.Shouichi Kamiya
-
Add
raise_on_missing_translationsoption toActiveModel::Translation. When the option is set,human_attribute_nameraises an error if a translation of the given attribute is missing.
ActiveModel::Translation.raise_on_missing_translations = false
Post.human_attribute_name("title")
=> "Title"
ActiveModel::Translation.raise_on_missing_translations = true
Post.human_attribute_name("title")
=> Translation missing. Options considered were: (I18n::MissingTranslationData)
- en.activerecord.attributes.post.title
- en.attributes.title
raise exception.respond_to?(:to_exception) ? exception.to_exception : exception
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
*Shouichi Kamiya*
-
Introduce
ActiveModel::AttributeAssignment#attribute_writer_missingProvide instances with an opportunity to gracefully handle assigning to an unknown attribute:
class Rectangle include ActiveModel::AttributeAssignment attr_accessor :length, :width def attribute_writer_missing(name, value) Rails.logger.warn "Tried to assign to unknown attribute #{name}" end end rectangle = Rectangle.new rectangle.assign_attributes(height: 10) # => Logs "Tried to assign to unknown attribute 'height'"Sean Doyle
Active Record
-
Fix support for
query_cache: falseindatabase.yml.query_cache: falsewould no longer entirely disable the Active Record query cache.zzak
-
NULLS NOT DISTINCT works with UNIQUE CONSTRAINT as well as UNIQUE INDEX.
Ryuta Kamizono
-
The
db:preparetask no longer loads seeds when a non-primary database is created.Previously, the
db:preparetask would load seeds whenever a new database is created, leading to potential loss of data if a database is added to an existing environment.Introduces a new database config property
seedsto control whether seeds are loaded duringdb:preparewhich defaults totruefor primary database configs andfalseotherwise.Fixes #53348.
Mike Dalessio
-
PG::UnableToSend: no connection to the serveris now retryable as a connection-related exceptionKazuma Watanabe
-
Fix strict loading propagation even if statement cache is not used.
Ryuta Kamizono
-
Allow
rename_enumaccepts two from/to name arguments asrename_tabledoes so.Ryuta Kamizono
-
Remove deprecated support to setting
ENV["SCHEMA_CACHE"].Rafael Mendonça França
-
Remove deprecated support to passing a database name to
cache_dump_filename.Rafael Mendonça França
-
Remove deprecated
ActiveRecord::ConnectionAdapters::ConnectionPool#connection.Rafael Mendonça França
-
Remove deprecated
config.active_record.sqlite3_deprecated_warning.Rafael Mendonça França
-
Remove deprecated
config.active_record.warn_on_records_fetched_greater_than.Rafael Mendonça França
-
Remove deprecated support for defining
enumwith keyword arguments.Rafael Mendonça França
-
Remove deprecated support to finding database adapters that aren't registered to Active Record.
Rafael Mendonça França
-
Remove deprecated
config.active_record.allow_deprecated_singular_associations_name.Rafael Mendonça França
-
Remove deprecated
config.active_record.commit_transaction_on_non_local_return.Rafael Mendonça França
-
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
-
Allow
ActiveRecord::Base#pluckto accept hash arguments with symbol and string values.Post.joins(:comments).pluck(:id, comments: :id) Post.joins(:comments).pluck("id", "comments" => "id")Joshua Young
-
Make Float distinguish between
float4andfloat8in PostgreSQL.Fixes #52742
Ryota Kitazawa, Takayuki Nagatomi
-
Allow
drop_tableto accept an array of table names.This will let you to drop multiple tables in a single call.
ActiveRecord::Base.lease_connection.drop_table(:users, :posts)Gabriel Sobrinho
-
Add support for PostgreSQL
IF NOT EXISTSvia the:if_not_existsoption on theadd_enum_valuemethod.Ariel Rzezak
-
When running
db:migrateon a fresh database, load the databases schemas before running migrations.Andrew Novoselac, Marek Kasztelnik
-
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
-
Deprecate
unsigned_floatandunsigned_decimalshort-hand column methods.As of MySQL 8.0.17, the UNSIGNED attribute is deprecated for columns of type FLOAT, DOUBLE, and DECIMAL. Consider using a simple CHECK constraint instead for such columns.
https://dev.mysql.com/doc/refman/8.0/en/numeric-type-syntax.html
Ryuta Kamizono
-
Drop MySQL 5.5 support.
MySQL 5.5 is the only version that does not support datetime with precision, which we have supported in the core. Now we support MySQL 5.6.4 or later, which is the first version to support datetime with precision.
Ryuta Kamizono
-
Make Active Record asynchronous queries compatible with transactional fixtures.
Previously transactional fixtures would disable asynchronous queries, because transactional fixtures impose all queries use the same connection.
Now asynchronous queries will use the connection pinned by transactional fixtures, and behave much closer to production.
Jean Boussier
-
Deserialize binary data before decrypting
This ensures that we call
PG::Connection.unescape_byteaon PostgreSQL before decryption.Donal McBreen
-
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
-
Add support for SQLite3 full-text-search and other virtual tables.
Previously, adding sqlite3 virtual tables messed up
schema.rb.Now, virtual tables can safely be added using
create_virtual_table.Zacharias Knudsen
-
Support use of alternative database interfaces via the
database_cliActiveRecord configuration option.Rails.application.configure do config.active_record.database_cli = { postgresql: "pgcli" } endT S Vallender
-
Add support for dumping table inheritance and native partitioning table definitions for PostgeSQL adapter
Justin Talbott
-
Add support for
ActiveRecord::Pointtype casts usingHashvaluesThis allows
ActiveRecord::Pointto be cast or serialized from a hash with:xand:ykeys of numeric values, mirroring the functionality of existing casts for string and array values. Both string and symbol keys are supported.class PostgresqlPoint < ActiveRecord::Base attribute :x, :point attribute :y, :point attribute :z, :point end val = PostgresqlPoint.new({ x: '(12.34, -43.21)', y: [12.34, '-43.21'], z: {x: '12.34', y: -43.21} }) ActiveRecord::Point.new(12.32, -43.21) == val.x == val.y == val.zStephen Drew
-
Replace
SQLite3::Database#busy_timeoutwith#busy_handler_timeout=.Provides a non-GVL-blocking, fair retry interval busy handler implementation.
Stephen Margheim
-
SQLite3Adapter: Translate
SQLite3::BusyExceptionintoActiveRecord::StatementTimeout.Matthew Nguyen
-
Include schema name in
enable_extensionstatements indb/schema.rb.The schema dumper will now include the schema name in generated
enable_extensionstatements if they differ from the current schema.For example, if you have a migration:
enable_extension "heroku_ext.pgcrypto" enable_extension "pg_stat_statements"then the generated schema dump will also contain:
enable_extension "heroku_ext.pgcrypto" enable_extension "pg_stat_statements"Tony Novak
-
Fix
ActiveRecord::Encryption::EncryptedAttributeType#typeto return actual cast type.Vasiliy Ermolovich
-
SQLite3Adapter: Bulk insert fixtures.
Previously one insert command was executed for each fixture, now they are aggregated in a single bulk insert command.
Lázaro Nixon
-
PostgreSQLAdapter: Allow
disable_extensionto be called with schema-qualified name.For parity with
enable_extension, thedisable_extensionmethod can be called with a schema-qualified name (e.g.disable_extension "myschema.pgcrypto"). Note that PostgreSQL'sDROP EXTENSIONdoes not actually take a schema name (unlikeCREATE EXTENSION), so the resulting SQL statement will only name the extension, e.g.DROP EXTENSION IF EXISTS "pgcrypto".Tony Novak
-
Make
create_schema/drop_schemareversible in migrations.Previously,
create_schemaanddrop_schemawere irreversible migration operations.Tony Novak
-
Support batching using custom columns.
Product.in_batches(cursor: [:shop_id, :id]) do |relation|
do something with relation
end
```
*fatkodima*
-
Use SQLite
IMMEDIATEtransactions when possible.Transactions run against the SQLite3 adapter default to IMMEDIATE mode to improve concurrency support and avoid busy exceptions.
Stephen Margheim
-
Raise specific exception when a connection is not defined.
The new
ConnectionNotDefinedexception provides connection name, shard and role accessors indicating the details of the connection that was requested.Hana Harencarova, Matthew Draper
-
Delete the deprecated constant
ActiveRecord::ImmutableRelation.Xavier Noria
-
Fix duplicate callback execution when child autosaves parent with
has_oneandbelongs_to.Before, persisting a new child record with a new associated parent record would run
before_validation,after_validation,before_saveandafter_savecallbacks twice.Now, these callbacks are only executed once as expected.
Joshua Young
-
ActiveRecord::Encryption::Encryptornow supports a:compressoroption to customize the compression algorithm used.module ZstdCompressor def self.deflate(data) Zstd.compress(data) end def self.inflate(data) Zstd.decompress(data) end end class User encrypts :name, compressor: ZstdCompressor endYou disable compression by passing
compress: false.class User encrypts :name, compress: false endheka1024
-
Add condensed
#inspectforConnectionPool,AbstractAdapter, andDatabaseConfig.Hartley McGuire
-
Add
.shard_keys,.sharded?, &.connected_to_all_shardsmethods.class ShardedBase < ActiveRecord::Base self.abstract_class = true connects_to shards: { shard_one: { writing: :shard_one }, shard_two: { writing: :shard_two } } end class ShardedModel < ShardedBase end ShardedModel.shard_keys => [:shard_one, :shard_two] ShardedModel.sharded? => true ShardedBase.connected_to_all_shards { ShardedModel.current_shard } => [:shard_one, :shard_two]Nony Dutton
-
Add a
filteroption toin_order_ofto prioritize certain values in the sorting without filtering the results by these values.Igor Depolli
-
Fix an issue where the IDs reader method did not return expected results for preloaded associations in models using composite primary keys.
Jay Ang
-
Allow to configure
strict_loading_modeglobally or within a model.Defaults to
:all, can be changed to:n_plus_one_only.Garen Torikian
-
Add
ActiveRecord::Relation#readonly?.Reflects if the relation has been marked as readonly.
Theodor Tonum
-
Improve
ActiveRecord::Storeto raise a descriptive exception if the column is not either structured (e.g., PostgreSQL +hstore+/+json+, or MySQL +json+) or declared serializable viaActiveRecord.store.Previously, a
NoMethodErrorwould be raised when the accessor was read or written:NoMethodError: undefined method `accessor' for an instance of ActiveRecord::Type::TextNow, a descriptive
ConfigurationErroris raised:ActiveRecord::ConfigurationError: the column 'metadata' has not been configured as a store. Please make sure the column is declared serializable via 'ActiveRecord.store' or, if your database supports it, use a structured column type like hstore or json.Mike Dalessio
-
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
-
Add public method for checking if a table is ignored by the schema cache.
Previously, an application would need to reimplement
ignored_table?from the schema cache class to check if a table was set to be ignored. This adds a public method to support this and updates the schema cache to use that directly.ActiveRecord.schema_cache_ignored_tables = ["developers"] ActiveRecord.schema_cache_ignored_table?("developers") => trueEileen M. Uchitelle
Action View
-
Remove deprecated support to passing a content to void tag elements on the
tagbuilder.Rafael Mendonça França
-
Remove deprecated support to passing
nilto themodel:argument ofform_with.Rafael Mendonça França
-
Enable DependencyTracker to evaluate renders with trailing interpolation.
<%= render "maintenance_tasks/runs/info/#{run.status}" %>Previously, the DependencyTracker would ignore this render, but now it will mark all partials in the "maintenance_tasks/runs/info" folder as dependencies.
Hartley McGuire
-
Rename
text_areamethods intotextareaOld names are still available as aliases.
Sean Doyle
-
Rename
check_box*methods intocheckbox*.Old names are still available as aliases.
Jean Boussier
Action Pack
-
Fix routes with
::in the path.Rafael Mendonça França
-
Maintain Rack 2 parameter parsing behaviour.
Matthew Draper
-
Remove
Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality.Rafael Mendonça França
-
Improve
ActionController::TestCaseto expose a binary encodedrequest.body.The rack spec clearly states:
The input stream is an IO-like object which contains the raw HTTP POST data. When applicable, its external encoding must be “ASCII-8BIT” and it must be opened in binary mode.
Until now its encoding was generally UTF-8, which doesn't accurately reflect production behavior.
Jean Boussier
-
Update
ActionController::AllowBrowserto support passing method names to:blockclass ApplicationController < ActionController::Base allow_browser versions: :modern, block: :handle_outdated_browser private def handle_outdated_browser render file: Rails.root.join("public/custom-error.html"), status: :not_acceptable end endSean Doyle
-
Raise an
ArgumentErrorwhen invalid:onlyor:exceptoptions are passed into#resourceand#resources.Joshua Young
-
Fix non-GET requests not updating cookies in
ActionController::TestCase.Jon Moss, Hartley McGuire
-
Update
ActionController::Liveto use a thread-pool to reuse threads across requests.Adam Renberg Tamm
-
Introduce safer, more explicit params handling method with
params#expectsuch thatparams.expect(table: [ :attr ])replacesparams.require(:table).permit(:attr)Ensures params are filtered with consideration for the expected types of values, improving handling of params and avoiding ignorable errors caused by params tampering.
If the url is altered to ?person=hacked
Before
params.require(:person).permit(:name, :age, pets: [:name])
raises NoMethodError, causing a 500 and potential error reporting
After
params.expect(person: [ :name, :age, pets: [[:name]] ])
raises ActionController::ParameterMissing, correctly returning a 400 error
```
You may also notice the new double array `[[:name]]`. In order to
declare when a param is expected to be an array of parameter hashes,
this new double array syntax is used to explicitly declare an array.
`expect` requires you to declare expected arrays in this way, and will
ignore arrays that are passed when, for example, `pet: [:name]` is used.
In order to preserve compatibility, `permit` does not adopt the new
double array syntax and is therefore more permissive about unexpected
types. Using `expect` everywhere is recommended.
We suggest replacing `params.require(:person).permit(:name, :age)`
with the direct replacement `params.expect(person: [:name, :age])`
to prevent external users from manipulating params to trigger 500
errors. A 400 error will be returned instead, using public/400.html
Usage of `params.require(:id)` should likewise be replaced with
`params.expect(:id)` which is designed to ensure that `params[:id]`
is a scalar and not an array or hash, also requiring the param.
```ruby
Before
User.find(params.require(:id)) # allows an array, altering behavior
After
User.find(params.expect(:id)) # expect only returns non-blank permitted scalars (excludes Hash, Array, nil, "", etc)
```
*Martin Emde*
-
System Testing: Disable Chrome's search engine choice by default in system tests.
glaszig
-
Fix
Request#raw_postraisingNoMethodErrorwhenrack.inputisnil.Hartley McGuire
-
Remove
raccdependency by manually writingActionDispatch::Journey::Scanner.Gannon McGibbon
-
Speed up
ActionDispatch::Routing::Mapper::Scope#[]by merging frame hashes.Gannon McGibbon
-
Allow bots to ignore
allow_browser.Matthew Nguyen
-
Deprecate drawing routes with multiple paths to make routing faster. You may use
with_optionsor a loop to make drawing multiple paths easier.
Before
get "/users", "/other_path", to: "users#index"
After
get "/users", to: "users#index"
get "/other_path", to: "users#index"
```
*Gannon McGibbon*
-
Make
http_cache_foreveruseimmutable: trueNate Matykiewicz
-
Add
config.action_dispatch.strict_freshness.When set to
true, theETagheader takes precedence over theLast-Modifiedheader when both are present, as specified by RFC 7232, Section 6.Defaults to
falseto maintain compatibility with previous versions of Rails, but is enabled as part of Rails 8.0 defaults.heka1024
-
Support
immutabledirective in Cache-Controlexpires_in 1.minute, public: true, immutable: true
Cache-Control: public, max-age=60, immutable
```
*heka1024*
-
Add
:wasm_unsafe_evalmapping forcontent_security_policy
Before
policy.script_src "'wasm-unsafe-eval'"
After
policy.script_src :wasm_unsafe_eval
```
*Joe Haig*
-
Add
display_captureandkeyboard_mapinpermissions_policyCyril Blaecke
-
Add
connectroute helper.Samuel Williams
Active Job
-
Remove deprecated
config.active_job.use_big_decimal_serializer.Rafael Mendonça França
-
Deprecate
sucker_punchas an adapter option.If you're using this adapter, change to
adapter: asyncfor the same functionality.Dino Maric, zzak
-
Use
RAILS_MAX_THREADSinActiveJob::AsyncAdapter. If it is not set, use 5 as default.heka1024
Action Mailer
- No changes.
Action Cable
-
Add an
identifierto the event payload for the ActiveSupport::Notificationtransmit_subscription_confirmation.action_cableandtransmit_subscription_rejection.action_cable.Keith Schacht
Active Storage
-
Deprecate
ActiveStorage::Service::AzureStorageService.zzak
-
Improve
ActiveStorage::Filename#sanitizedmethod to handle special characters more effectively. Replace the characters"*?<>with-if they exist in the Filename to match the Filename convention of Win OS.Luong Viet Dung(Martin)
-
Improve InvariableError, UnpreviewableError and UnrepresentableError message.
Include Blob ID and content_type in the messages.
Petrik de Heus
-
Mark proxied files as
immutablein their Cache-Control headerNate Matykiewicz
Action Mailbox
- No changes.
Action Text
-
Dispatch direct-upload events on attachment uploads
When using Action Text's rich textarea, it's possible to attach files to the editor. Previously, that action didn't dispatch any events, which made it hard to react to the file uploads. For instance, if an upload failed, there was no way to notify the user about it, or remove the attachment from the editor.
This commits adds new events -
direct-upload:start,direct-upload:progress, anddirect-upload:end- similar to how Active Storage's direct uploads work.Matheus Richard, Brad Rees
-
Add
store_if_blankoption tohas_rich_textPass
store_if_blank: falseto not createActionText::RichTextrecords when saving with a blank attribute, such as from an optional form parameter.class Message has_rich_text :content, store_if_blank: false end Message.create(content: "hi") # creates an ActionText::RichText Message.create(content: "") # does not create an ActionText::RichTextAlex Ghiculescu
-
Strip
contentattribute if the key is present but the value is emptyJeremy Green
-
Rename
rich_text_areamethods intorich_textareaOld names are still available as aliases.
Sean Doyle
-
Only sanitize
contentattribute when present in attachments.Petrik de Heus
Railties
-
Fix incorrect database.yml with
skip_solid.Joé Dupuis
-
Set
Regexp.timeoutto1s by default to improve security over Regexp Denial-of-Service attacks.Rafael Mendonça França
-
Remove deprecated support to extend Rails console through
Rails::ConsoleMethods.Rafael Mendonça França
-
Remove deprecated file
rails/console/helpers.Rafael Mendonça França
-
Remove deprecated file
rails/console/app.Rafael Mendonça França
-
Remove deprecated
config.read_encrypted_secrets.Rafael Mendonça França
-
Add Kamal support for devcontainers
Previously generated devcontainer could not use docker and therefore Kamal.
Joé Dupuis
-
Exit
rails gwith code 1 if generator could not be found.Previously
rails greturned 0, which would make it harder to catch typos in scripts callingrails g.Christopher Özbek
-
Remove
require_*statements from application.css to align with the transition from Sprockets to Propshaft.With Propshaft as the default asset pipeline in Rails 8, the require_tree and require_self clauses in application.css are no longer necessary, as they were specific to Sprockets. Additionally, the comment has been updated to clarify that CSS precedence now follows standard cascading order without automatic prioritization by the asset pipeline.
Eduardo Alencar
-
Do not include redis by default in generated Dev Containers.
Now that applications use the Solid Queue and Solid Cache gems by default, we do not need to include redis in the Dev Container. We will only include redis if
--skip-solidis used when generating an app that uses Active Job or Action Cable.When generating a Dev Container for an existing app, we will not include redis if either of the solid gems are in use.
Andrew Novoselac
-
Use Solid Cable as the default Action Cable adapter in production, configured as a separate queue database in config/database.yml. It keeps messages in a table and continuously polls for updates. This makes it possible to drop the common dependency on Redis, if it isn't needed for any other purpose. Despite polling, the performance of Solid Cable is comparable to Redis in most situations. And in all circumstances, it makes it easier to deploy Rails when Redis is no longer a required dependency for Action Cable functionality.
DHH
-
Use Solid Queue as the default Active Job backend in production, configured as a separate queue database in config/database.yml. In a single-server deployment, it'll run as a Puma plugin. This is configured in
config/deploy.ymland can easily be changed to use a dedicated jobs machine.DHH
-
Use Solid Cache as the default Rails.cache backend in production, configured as a separate cache database in config/database.yml.
DHH
-
Add Rails::Rack::SilenceRequest middleware and use it via
config.silence_healthcheck_path = pathto silence requests to "/up". This prevents the Kamal-required health checks from clogging up the production logs.DHH
-
Introduce
mariadb-mysqlandmariadb-trilogydatabase options forrails newWhen used with the
--devcontainerflag, these options will usemariadbas the database for the Dev Container. The originalmysqlandtrilogyoptions will usemysql. Users who are not generating a Dev Container do not need to use the new options.Andrew Novoselac
-
Deprecate
::STATS_DIRECTORIES.The global constant
STATS_DIRECTORIEShas been deprecated in favor ofRails::CodeStatistics.register_directory.Add extra directories with
Rails::CodeStatistics.register_directory(label, path):require "rails/code_statistics" Rails::CodeStatistics.register_directory('My Directory', 'path/to/dir')Petrik de Heus
-
Enable query log tags by default on development env
This can be used to trace troublesome SQL statements back to the application code that generated these statements. It is also useful when using multiple databases because the query logs can identify which database is being used.
Matheus Richard
-
Defer route drawing to the first request, or when url_helpers are called
Executes the first routes reload in middleware, or when a route set's url_helpers receives a route call / asked if it responds to a route. Previously, this was executed unconditionally on boot, which can slow down boot time unnecessarily for larger apps with lots of routes.
Environments like production that have
config.eager_load = truewill continue to eagerly load routes on boot.Gannon McGibbon
-
Generate form helpers to use
textarea*methods instead oftext_area*methodsSean Doyle
-
Add authentication generator to give a basic start to an authentication system using database-tracked sessions and password reset.
Generate with...
bin/rails generate authenticationGenerated files:
app/models/current.rb app/models/user.rb app/models/session.rb app/controllers/sessions_controller.rb app/controllers/passwords_controller.rb app/mailers/passwords_mailer.rb app/views/sessions/new.html.erb app/views/passwords/new.html.erb app/views/passwords/edit.html.erb app/views/passwords_mailer/reset.html.erb app/views/passwords_mailer/reset.text.erb db/migrate/xxxxxxx_create_users.rb db/migrate/xxxxxxx_create_sessions.rb test/mailers/previews/passwords_mailer_preview.rbDHH
-
Add not-null type modifier to migration attributes.
Generating with...
bin/rails generate migration CreateUsers email_address:string!:uniq password_digest:string!Produces:
class CreateUsers < ActiveRecord::Migration[8.0] def change create_table :users do |t| t.string :email_address, null: false t.string :password_digest, null: false t.timestamps end add_index :users, :email_address, unique: true end endDHH
-
Add a
scriptfolder to applications, and a scripts generator.The new
scriptfolder is meant to hold one-off or general purpose scripts, such as data migration scripts, cleanup scripts, etc.A new script generator allows you to create such scripts:
bin/rails generate script my_script bin/rails generate script data/backfillYou can run the generated script using:
bundle exec ruby script/my_script.rb bundle exec ruby script/data/backfill.rbJerome Dalbert, Haroon Ahmed
-
Deprecate
bin/rake statsin favor ofbin/rails stats.Juan Vásquez
-
Add internal page
/rails/info/notes, that displays the same information asbin/rails notes.Deepak Mahakale
-
Add Rubocop and GitHub Actions to plugin generator. This can be skipped using --skip-rubocop and --skip-ci.
Chris Oliver
-
Use Kamal for deployment by default, which includes generating a Rails-specific config/deploy.yml. This can be skipped using --skip-kamal. See more: https://kamal-deploy.org/
DHH
Guides
-
The guide Classic to Zeitwerk HOWTO that documented how to migrate from the
classicautoloader to Zeitwerk has been deleted.The last version of this guide can be found here, in case you need it.
Petrik de Heus
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_att
Configuration
📅 Schedule: Branch creation - "before 2am" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
- [ ] If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.
⚠️ Artifact update problem
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
- any of the package files in this branch needs updating, or
- the branch becomes conflicted, or
- you click the rebase/retry checkbox if found above, or
- you rename this PR's title to start with "rebase!" to trigger it manually
The artifact failure details are included below:
File name: Gemfile.lock
[01:41:39.719] INFO (887): Installing tool [email protected]...
/usr/local/containerbase/tools/v2/ruby.sh: line 80: /etc/gemrc: Permission denied
[01:41:40.449] ERROR (887): Command failed with exit code 1: bash /usr/local/containerbase/bin/v2-install-tool.sh install ruby 3.0.3
[01:41:40.450] FATAL (887): Install tool ruby failed in 739ms.