Rails

What Is New In Rails 7.2: Key Features

Rails 7.2 has just been released, packed with a range of exciting updates that enhance the Rails development experience.

Rails Warns On Tests Without Assertions.

With Rails 7.2, `ActiveSupport::TestCase` now warns when tests do not run any assertions.

Rails in_order_of Filter Option

Rails added the filter option to in_order_of to prioritize the specified values without filtering the results

Rails 7.1 Composite Primary Key Support

ActiveRecord models can now be configured with composite primary keys, making it easier to work with complex data models.

Rails 7.2 Adds Support For Devcontainer.

In Rails 7.2, use `--devcontainer` flag with `rails new` to add a devcontainer to new apps and run `bin/rails devcontainer` for existing apps.

Rails SKIP_TEST_DATABASE_TRUNCATE Flag

Rails 7.2 adds SKIP_TEST_DATABASE_TRUNCATE flag to speed up multi-process test runs by skipping table truncations on large databases.

Puma-dev: Run Multiple Rails Apps Locally

Use puma-dev to run multiple Rails apps with custom .test domains and HTTPS locally.

Rails 7.2 app:update as Rails Command

The app:update task to be a Rails command, and adds the --force flag to it, to allow running bin/rails app:update while accepting all the changes it makes.

Rails after_all_transactions_commit Callback

Rails 7.2 adds after_all_transactions_commit to safely run actions like job enqueuing only after all transactions are committed.

Rails with_connection for DB Optimization

Rails 7.2 adds with_connection to lease database connections only for a block's duration, improving concurrency for IO-heavy apps.