123456789_123456789_123456789_123456789_123456789_

DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON https://guides.rubyonrails.org.

Ruby on Rails 6.1 Release Notes

Highlights in Rails 6.1:

These release notes cover only the major changes. To learn about various bug fixes and changes, please refer to the changelogs or check out the list of commits in the main Rails repository on GitHub.


Upgrading to Rails 6.1

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.0 in case you haven't and make sure your application still runs as expected before attempting an update to Rails 6.1. A list of things to watch out for when upgrading is available in the Upgrading Ruby on Rails guide.

Major Features

Per-database Connection Switching

Rails 6.1 provides you with the ability to switch connections per-database. In 6.0 if you switched to the reading role then all database connections also switched to the reading role. Now in 6.1 if you set legacy_connection_handling to false in your configuration, Rails will allow you to switch connections for a single database by calling connected_to on the corresponding abstract class.

Horizontal Sharding

Rails 6.0 provided the ability to functionally partition (multiple partitions, different schemas) your database but wasn't able to support horizontal sharding (same schema, multiple partitions). Rails wasn't able to support horizontal sharding because models in Active Record could only have one connection per-role per-class. This is now fixed and horizontal sharding with Rails is available.

Strict Loading Associations

Strict loading associations allows you to ensure that all your associations are loaded eagerly and stop N+1's before they happen.

Delegated Types

Delegated Types is an alternative to single-table inheritance. This helps represent class hierarchies allowing the superclass to be a concrete class that is represented by its own table. Each subclass has its own table for additional attributes.

Destroy Associations Async

Destroy associations async adds the ability for applications to destroy associations in a background job. This can help you avoid timeouts and other performance issues in your application when destroying data.

Railties

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Action Cable

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Action Pack

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Action View

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Action Mailer

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Active Record

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Active Storage

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Active Model

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Active Support

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Active Job

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Action Text

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Action Mailbox

Please refer to the Changelog for detailed changes.

Removals

Deprecations

Notable changes

Ruby on Rails Guides

Please refer to the Changelog for detailed changes.

Notable changes

Credits

See the full list of contributors to Rails for the many people who spent many hours making Rails, the stable and robust framework it is. Kudos to all of them.