2020-12-17 15:00:58 -05:00
|
|
|
**DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON https://guides.rubyonrails.org.**
|
|
|
|
|
2021-02-04 11:46:53 -05:00
|
|
|
Ruby on Rails 7.0 Release Notes
|
2020-12-17 15:00:58 -05:00
|
|
|
===============================
|
|
|
|
|
2021-02-04 11:46:53 -05:00
|
|
|
Highlights in Rails 7.0:
|
|
|
|
|
2021-02-06 14:12:51 -05:00
|
|
|
* Ruby 2.7.0+ required, Ruby 3.0+ preferred
|
2020-12-17 15:00:58 -05:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2021-02-04 11:46:53 -05:00
|
|
|
Upgrading to Rails 7.0
|
2020-12-17 15:00:58 -05:00
|
|
|
----------------------
|
|
|
|
|
|
|
|
If you're upgrading an existing application, it's a great idea to have good test
|
|
|
|
coverage before going in. You should also first upgrade to Rails 6.1 in case you
|
|
|
|
haven't and make sure your application still runs as expected before attempting
|
2021-02-04 11:46:53 -05:00
|
|
|
an update to Rails 7.0. A list of things to watch out for when upgrading is
|
2020-12-17 15:00:58 -05:00
|
|
|
available in the
|
2021-02-25 16:25:27 -05:00
|
|
|
[Upgrading Ruby on Rails](upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0)
|
2020-12-17 15:00:58 -05:00
|
|
|
guide.
|
|
|
|
|
|
|
|
Major Features
|
|
|
|
--------------
|
|
|
|
|
|
|
|
Railties
|
|
|
|
--------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][railties] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
2021-12-02 23:02:40 -05:00
|
|
|
* Remove deprecated `config` in `dbconsole`.
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Deprecations
|
|
|
|
|
|
|
|
### Notable changes
|
|
|
|
|
2021-12-07 14:50:19 -05:00
|
|
|
* Sprockets is not an opinional dependency
|
|
|
|
|
|
|
|
The gem `rails` doesn't depend on `sprockets-rails` anymore. If your application still needs to use Sprockets,
|
|
|
|
make sure to add `sprockets-rails` to your Gemfile.
|
|
|
|
|
|
|
|
```
|
|
|
|
gem "sprockets-rails"
|
|
|
|
```
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
Action Cable
|
|
|
|
------------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][action-cable] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
|
|
|
### Deprecations
|
|
|
|
|
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Action Pack
|
|
|
|
-----------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][action-pack] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
2021-10-13 12:46:18 -04:00
|
|
|
* Remove deprecated `ActionDispatch::Response.return_only_media_type_on_content_type`.
|
|
|
|
|
2021-10-13 16:46:26 -04:00
|
|
|
* Remove deprecated `Rails.config.action_dispatch.hosts_response_app`.
|
|
|
|
|
2021-10-13 16:52:22 -04:00
|
|
|
* Remove deprecated `ActionDispatch::SystemTestCase#host!`.
|
|
|
|
|
2021-10-14 17:51:50 -04:00
|
|
|
* Remove deprecated support to passing a path to `fixture_file_upload` relative to `fixture_path`.
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Deprecations
|
|
|
|
|
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Action View
|
|
|
|
-----------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][action-view] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
2021-10-14 18:09:03 -04:00
|
|
|
* Remove deprecated `Rails.config.action_view.raise_on_missing_translations`.
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Deprecations
|
|
|
|
|
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Action Mailer
|
|
|
|
-------------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][action-mailer] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
2021-10-12 17:50:40 -04:00
|
|
|
* Remove deprecated `ActionMailer::DeliveryJob` and `ActionMailer::Parameterized::DeliveryJob`
|
|
|
|
in favor of `ActionMailer::MailDeliveryJob`.
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Deprecations
|
|
|
|
|
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Active Record
|
|
|
|
-------------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][active-record] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
|
|
|
* Remove deprecated `database` kwarg from `connected_to`.
|
|
|
|
|
2021-11-16 15:02:35 -05:00
|
|
|
* Remove deprecated `ActiveRecord::Base.allow_unsafe_raw_sql`.
|
|
|
|
|
2021-11-16 15:18:08 -05:00
|
|
|
* Remove deprecated option `:spec_name` in the `configs_for` method.
|
|
|
|
|
2021-11-16 15:34:50 -05:00
|
|
|
* Remove deprecated support to YAML load `ActiveRecord::Base` instance in the Rails 4.2 and 4.1 formats.
|
|
|
|
|
2021-11-17 13:50:24 -05:00
|
|
|
* Remove deprecation warning when using `:interval` column is used in PostgreSQL database.
|
|
|
|
|
|
|
|
Now, interval columns will return `ActiveSupport::Duration` objects instead of strings.
|
|
|
|
|
|
|
|
To keep the old behavior, you can add this line to your model:
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
attribute :column, :string
|
|
|
|
```
|
|
|
|
|
2021-12-07 10:39:54 -05:00
|
|
|
* Remove deprecated support to resolve connection using `"primary"` as connection specification name.
|
2021-11-17 14:12:13 -05:00
|
|
|
|
2021-11-17 14:21:11 -05:00
|
|
|
* Remove deprecated support to quote `ActiveRecord::Base` objects.
|
|
|
|
|
2021-11-17 14:27:02 -05:00
|
|
|
* Remove deprecated support to type cast to database values `ActiveRecord::Base` objects.
|
|
|
|
|
2021-11-17 16:20:21 -05:00
|
|
|
* Remove deprecated support to pass a column to `type_cast`.
|
|
|
|
|
2021-11-17 17:41:10 -05:00
|
|
|
* Remove deprecated `DatabaseConfig#config` method.
|
|
|
|
|
2021-11-17 18:08:29 -05:00
|
|
|
* Remove deprecated rake tasks:
|
|
|
|
|
|
|
|
* `db:schema:load_if_ruby`
|
|
|
|
* `db:structure:dump`
|
|
|
|
* `db:structure:load`
|
|
|
|
* `db:structure:load_if_sql`
|
|
|
|
* `db:structure:dump:#{name}`
|
|
|
|
* `db:structure:load:#{name}`
|
|
|
|
* `db:test:load_structure`
|
|
|
|
* `db:test:load_structure:#{name}`
|
|
|
|
|
2021-11-18 10:19:29 -05:00
|
|
|
* Remove deprecated support to `Model.reorder(nil).first` to search using non-deterministic order.
|
|
|
|
|
2021-11-18 13:54:27 -05:00
|
|
|
* Remove deprecated `environment` and `name` arguments from `Tasks::DatabaseTasks.schema_up_to_date?`.
|
|
|
|
|
2021-11-18 15:20:37 -05:00
|
|
|
* Remove deprecated `Tasks::DatabaseTasks.dump_filename`.
|
|
|
|
|
|
|
|
* Remove deprecated `Tasks::DatabaseTasks.schema_file`.
|
|
|
|
|
|
|
|
* Remove deprecated `Tasks::DatabaseTasks.spec`.
|
|
|
|
|
|
|
|
* Remove deprecated `Tasks::DatabaseTasks.current_config`.
|
|
|
|
|
2021-12-02 23:02:40 -05:00
|
|
|
* Remove deprecated `ActiveRecord::Connection#allowed_index_name_length`.
|
|
|
|
|
|
|
|
* Remove deprecated `ActiveRecord::Connection#in_clause_length`.
|
|
|
|
|
|
|
|
* Remove deprecated `ActiveRecord::DatabaseConfigurations::DatabaseConfig#spec_name`.
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Deprecations
|
|
|
|
|
2021-12-02 23:02:40 -05:00
|
|
|
* Deprecated `Tasks::DatabaseTasks.schema_file_type`.
|
2021-11-18 15:20:37 -05:00
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Notable changes
|
|
|
|
|
2021-11-17 17:31:53 -05:00
|
|
|
* Rollback transactions when the block returns earlier than expected.
|
|
|
|
|
|
|
|
Before this change, when a transaction block returned early, the transaction would be committed.
|
|
|
|
|
|
|
|
The problem is that timeouts triggered inside the transaction block was also making the incomplete transaction
|
|
|
|
to be committed, so in order to avoid this mistake, the transaction block is rolled back.
|
|
|
|
|
2021-11-18 13:47:07 -05:00
|
|
|
* Merging conditions on the same column no longer maintain both conditions,
|
|
|
|
and will be consistently replaced by the latter condition.
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
# Rails 6.1 (IN clause is replaced by merger side equality condition)
|
|
|
|
Author.where(id: [david.id, mary.id]).merge(Author.where(id: bob)) # => [bob]
|
|
|
|
# Rails 6.1 (both conflict conditions exists, deprecated)
|
|
|
|
Author.where(id: david.id..mary.id).merge(Author.where(id: bob)) # => []
|
|
|
|
# Rails 6.1 with rewhere to migrate to Rails 7.0's behavior
|
|
|
|
Author.where(id: david.id..mary.id).merge(Author.where(id: bob), rewhere: true) # => [bob]
|
|
|
|
# Rails 7.0 (same behavior with IN clause, mergee side condition is consistently replaced)
|
|
|
|
Author.where(id: [david.id, mary.id]).merge(Author.where(id: bob)) # => [bob]
|
|
|
|
Author.where(id: david.id..mary.id).merge(Author.where(id: bob)) # => [bob]
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
Active Storage
|
|
|
|
--------------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][active-storage] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
|
|
|
### Deprecations
|
|
|
|
|
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Active Model
|
|
|
|
------------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][active-model] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
2021-11-15 18:53:00 -05:00
|
|
|
* Remove deprecated enumeration of `ActiveModel::Errors` instances as a Hash.
|
|
|
|
|
2021-11-15 19:01:29 -05:00
|
|
|
* Remove deprecated `ActiveModel::Errors#to_h`.
|
|
|
|
|
2021-11-15 19:04:37 -05:00
|
|
|
* Remove deprecated `ActiveModel::Errors#slice!`.
|
|
|
|
|
2021-11-15 19:06:05 -05:00
|
|
|
* Remove deprecated `ActiveModel::Errors#values`.
|
|
|
|
|
2021-11-15 19:08:36 -05:00
|
|
|
* Remove deprecated `ActiveModel::Errors#keys`.
|
|
|
|
|
2021-11-15 19:10:02 -05:00
|
|
|
* Remove deprecated `ActiveModel::Errors#to_xml`.
|
|
|
|
|
2021-11-15 19:50:35 -05:00
|
|
|
* Remove deprecated support concat errors to `ActiveModel::Errors#messages`.
|
|
|
|
|
2021-11-16 12:58:30 -05:00
|
|
|
* Remove deprecated support to `clear` errors from `ActiveModel::Errors#messages`.
|
2021-11-16 11:22:18 -05:00
|
|
|
|
2021-11-16 12:58:30 -05:00
|
|
|
* Remove deprecated support to `delete` errors from `ActiveModel::Errors#messages`.
|
|
|
|
|
|
|
|
* Remove deprecated support to use `[]=` in `ActiveModel::Errors#messages`.
|
2021-11-16 11:50:09 -05:00
|
|
|
|
2021-11-16 13:01:21 -05:00
|
|
|
* Remove support to Marshal and YAML load Rails 5.x error format.
|
|
|
|
|
2021-11-16 14:56:30 -05:00
|
|
|
* Remove support to Marshal load Rails 5.x `ActiveModel::AttributeSet` format.
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Deprecations
|
|
|
|
|
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Active Support
|
|
|
|
--------------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][active-support] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
2021-11-18 15:27:56 -05:00
|
|
|
* Remove deprecated `config.active_support.use_sha1_digests`.
|
|
|
|
|
2021-11-18 17:40:41 -05:00
|
|
|
* Remove deprecated `URI.parser`.
|
|
|
|
|
2021-11-18 19:04:26 -05:00
|
|
|
* Remove deprecated support to use `Range#include?` to check the inclusion of a value in
|
|
|
|
a date time range is deprecated.
|
|
|
|
|
2021-11-19 17:00:17 -05:00
|
|
|
* Remove deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
|
|
|
|
|
2021-11-18 17:40:41 -05:00
|
|
|
### Deprecations
|
|
|
|
|
2021-12-06 15:02:37 -05:00
|
|
|
* Deprecate passing a format to `#to_s` in favor of `#to_formatted_s` in `Array`, `Range`, `Date`, `DateTime`, `Time`,
|
|
|
|
`BigDecimal`, `Float` and, `Integer`.
|
|
|
|
|
|
|
|
This deprecation is to allow Rails application to take advantage of a Ruby 3.1
|
|
|
|
[optimization][https://github.com/ruby/ruby/commit/b08dacfea39ad8da3f1fd7fdd0e4538cc892ec44] that makes
|
|
|
|
interpolation of some types of objects faster.
|
|
|
|
|
2021-12-07 01:51:45 -05:00
|
|
|
New applications will not have the `#to_s` method overridden on those classes, existing applications can use
|
2021-12-06 15:02:37 -05:00
|
|
|
`config.active_support.disable_to_s_conversion`.
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Active Job
|
|
|
|
----------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][active-job] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
2021-10-14 18:29:35 -04:00
|
|
|
* Removed deprecated behavior that was not halting `after_enqueue`/`after_perform` callbacks when a
|
|
|
|
previous callback was halted with `throw :abort`.
|
|
|
|
|
2021-11-19 17:04:55 -05:00
|
|
|
* Remove deprecated `:return_false_on_aborted_enqueue` option.
|
|
|
|
|
2021-11-19 17:13:46 -05:00
|
|
|
* Remove deprecated `ActiveRecord::Base.connection_config`.
|
|
|
|
|
2021-11-19 17:38:47 -05:00
|
|
|
* Remove deprecated `ActiveRecord::Base.arel_attribute`.
|
|
|
|
|
2021-11-19 17:51:12 -05:00
|
|
|
* Remove deprecated `ActiveRecord::Base.configurations.default_hash`.
|
|
|
|
|
2021-11-19 18:04:04 -05:00
|
|
|
* Remove deprecated `ActiveRecord::Base.configurations.to_h`.
|
|
|
|
|
2021-11-19 18:15:38 -05:00
|
|
|
* Remove deprecated `ActiveRecord::Result#map!` and `ActiveRecord::Result#collect!`.
|
|
|
|
|
2021-12-02 23:02:40 -05:00
|
|
|
* Remove deprecated `ActiveRecord::Base#remove_connection`.
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Deprecations
|
|
|
|
|
2021-10-14 18:29:35 -04:00
|
|
|
* Deprecated `Rails.config.active_job.skip_after_callbacks_if_terminated`.
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Action Text
|
|
|
|
----------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][action-text] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
|
|
|
### Deprecations
|
|
|
|
|
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Action Mailbox
|
|
|
|
----------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][action-mailbox] for detailed changes.
|
|
|
|
|
|
|
|
### Removals
|
|
|
|
|
2021-10-12 17:15:09 -04:00
|
|
|
* Removed deprecated `Rails.application.credentials.action_mailbox.mailgun_api_key`.
|
|
|
|
|
|
|
|
* Removed deprecated environment variable `MAILGUN_INGRESS_API_KEY`.
|
|
|
|
|
2020-12-17 15:00:58 -05:00
|
|
|
### Deprecations
|
|
|
|
|
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Ruby on Rails Guides
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
Please refer to the [Changelog][guides] for detailed changes.
|
|
|
|
|
|
|
|
### Notable changes
|
|
|
|
|
|
|
|
Credits
|
|
|
|
-------
|
|
|
|
|
|
|
|
See the
|
|
|
|
[full list of contributors to Rails](https://contributors.rubyonrails.org/)
|
|
|
|
for the many people who spent many hours making Rails, the stable and robust
|
|
|
|
framework it is. Kudos to all of them.
|
|
|
|
|
2021-12-07 10:53:12 -05:00
|
|
|
[railties]: https://github.com/rails/rails/blob/7-0-stable/railties/CHANGELOG.md
|
|
|
|
[action-pack]: https://github.com/rails/rails/blob/7-0-stable/actionpack/CHANGELOG.md
|
|
|
|
[action-view]: https://github.com/rails/rails/blob/7-0-stable/actionview/CHANGELOG.md
|
|
|
|
[action-mailer]: https://github.com/rails/rails/blob/7-0-stable/actionmailer/CHANGELOG.md
|
|
|
|
[action-cable]: https://github.com/rails/rails/blob/7-0-stable/actioncable/CHANGELOG.md
|
|
|
|
[active-record]: https://github.com/rails/rails/blob/7-0-stable/activerecord/CHANGELOG.md
|
|
|
|
[active-storage]: https://github.com/rails/rails/blob/7-0-stable/activestorage/CHANGELOG.md
|
|
|
|
[active-model]: https://github.com/rails/rails/blob/7-0-stable/activemodel/CHANGELOG.md
|
|
|
|
[active-support]: https://github.com/rails/rails/blob/7-0-stable/activesupport/CHANGELOG.md
|
|
|
|
[active-job]: https://github.com/rails/rails/blob/7-0-stable/activejob/CHANGELOG.md
|
|
|
|
[action-text]: https://github.com/rails/rails/blob/7-0-stable/actiontext/CHANGELOG.md
|
|
|
|
[action-mailbox]: https://github.com/rails/rails/blob/7-0-stable/actionmailbox/CHANGELOG.md
|
|
|
|
[guides]: https://github.com/rails/rails/blob/7-0-stable/guides/CHANGELOG.md
|