rails 6.0.3
In this version, we fixed warnings when used with Ruby 2.7 across the entire framework.
Following are the list of other changes, per-framework.
Active Support
-
Array#to_sentenceno longer returns a frozen string.Before:
['one', 'two'].to_sentence.frozen? # => trueAfter:
['one', 'two'].to_sentence.frozen? # => falseNicolas Dular
-
Update
ActiveSupport::Messages::Metadata#fresh?to work for cookies with expiry set whenActiveSupport.parse_json_times = true.Christian Gregg
Active Model
- No changes.
Active Record
-
Recommend applications don't use the
databasekwarg inconnected_toThe database kwarg in
connected_towas meant to be used for one-off scripts but is often used in requests. This is really dangerous because it re-establishes a connection every time. It's deprecated in 6.1 and will be removed in 6.2 without replacement. This change soft deprecates it in 6.0 by removing documentation.Eileen M. Uchitelle
-
Fix support for PostgreSQL 11+ partitioned indexes.
Sebastián Palma
-
Add support for beginless ranges, introduced in Ruby 2.7.
Josh Goodall
-
Fix insert_all with enum values
Fixes #38716.
Joel Blum
-
Regexp-escape table name for MS SQL
Add
Regexp.escapeto one method in ActiveRecord, so that table names with regular expression characters in them work as expected. Since MS SQL Server uses "[" and "]" to quote table and column names, and those characters are regular expression characters, methods likepluckandselectfail in certain cases when used with the MS SQL Server adapter.Larry Reid
-
Store advisory locks on their own named connection.
Previously advisory locks were taken out against a connection when a migration started. This works fine in single database applications but doesn't work well when migrations need to open new connections which results in the lock getting dropped.
In order to fix this we are storing the advisory lock on a new connection with the connection specification name
AdisoryLockBase. The caveat is that we need to maintain at least 2 connections to a database while migrations are running in order to do this.Eileen M. Uchitelle, John Crepezzi
-
Ensure
:readingconnections always raise if a write is attempted.Now Rails will raise an
ActiveRecord::ReadOnlyErrorif any connection on the reading handler attempts to make a write. If your reading role needs to write you should name the role something other than:reading.Eileen M. Uchitelle
-
Enforce fresh ETag header after a collection's contents change by adding ActiveRecord::Relation#cache_key_with_version. This method will be used by ActionController::ConditionalGet to ensure that when collection cache versioning is enabled, requests using ConditionalGet don't return the same ETag header after a collection is modified. Fixes #38078.
Aaron Lipman
-
A database URL can now contain a querystring value that contains an equal sign. This is needed to support passing PostgresSQL
options.Joshua Flanagan
-
Retain explicit selections on the base model after applying
includesandjoins.Resolves #34889.
Patrick Rebsch
Action View
-
annotated_source_code returns an empty array so TemplateErrors without a template in the backtrace are surfaced properly by DebugExceptions.
Guilherme Mansur, Kasper Timm Hansen
-
Add autoload for SyntaxErrorInTemplate so syntax errors are correctly raised by DebugExceptions.
Guilherme Mansur, Gannon McGibbon
Action Pack
-
Include child session assertion count in ActionDispatch::IntegrationTest
IntegrationTest#open_sessionusesdupto create the new session, which meant it had its own copy of@assertions. This prevented the assertions from being correctly counted and reported.Child sessions now have their
attr_accessoroverriden to delegate to the root session.Fixes #32142
Sam Bostock
Active Job
-
While using
perform_enqueued_jobstest helper enqueued jobs must be stored for the later check withassert_enqueued_with.Dmitry Polushkin
-
Add queue name support to Que adapter
Brad Nauta, Wojciech Wnętrzak
Action Mailer
- No changes.
Action Cable
- No changes.
Active Storage
- No changes.
Action Mailbox
-
Update Mandrill inbound email route to respond appropriately to HEAD requests for URL health checks from Mandrill.
Bill Cromie
Action Text
- No changes.
Railties
-
Cache compiled view templates when running tests by default
When generating a new app without
--skip-spring, caching classes is disabled inenvironments/test.rb. This implicitly disables caching view templates too. This change will enable view template caching by adding this to the generatedenvironments/test.rb:config.action_view.cache_template_loading = trueJorge Manrubia
-
Rails::Application#eager_load!is available again to load application code manually as it was possible in previous versions.Please, note this is not integrated with the whole eager loading logic that runs when Rails boots with eager loading enabled, you can think of this method as a vanilla recursive code loader.
This ability has been restored because there are some use cases for it, such as indexers that need to have all application classes and modules in memory.
Xavier Noria
-
Generators that inherit from NamedBase respect
--forceoptionJosh Brody
-
Regression fix: The Rake task
zeitwerk:checksupports eager loaded namespaces which do not have eager load paths, like the recently addedi18n. These namespaces are only required to respond toeager_load!.Xavier Noria