Rails6

Rails 6.1 Adds if_not_exists for Indexes

Rails 6.1 adds if_not_exists option to add_index, propagating from create_table to indexes in the same block.

Using Interactors in Rails Applications

Interactors provide a common interface for performing complex user interactions.

Rails Adds Descending Order to Batch Methods

Rails 6.1 adds order option to find_each, find_in_batches, and in_batches for ascending or descending processing.

Rails Adds db:rollback:name for Multi-DB

Rails has added support for name option while rollbacking migration for multiple database application

Rails 6.1 Adds Enumerable#pick

Adding pick to enumerable will enable us to call pick on loaded relations, unloaded relations, and plain enumerables interchangeably.

Using Optimizer Hints in Rails

Optimizer Hints allows us to control the query optimizer of a database system. Rails 6 has added support to provide Optimizer Hints.

Rails Relation#pick Uses Loaded Results

Rails ActiveRecord::Relation#pick now uses already loaded results instead of making a new query everytime.

Rails Adds :from/:to to previously_changed?

Rails Active Model Dirty method [attribute_name]_previously_changed? now accepts :from and :to arguments just like [attribute_name]_changed?

Rails Adds Schema Cache Path Configuration

Rails now exposes a new configuration for specifying the location of the schema cache file. This can be done in database.yml using schema_cache_path key.

Eager Loading Active Storage to Avoid N+1

Removing N+1 queries when we access the Active Storage attachments associated with an ActiveRecord model.