With the exciting release of Rails 8.0, Ruby on Rails is back with powerful new features and improvements that web developers won’t want to miss.

Designed to make development faster, more streamlined, and even more enjoyable, Rails 8.0 brings updates that tackle real-world challenges faced by both new developers and experienced teams upgrading their projects.

In this post, we’ll explore the release highlights, breaking down how each enhancement can make your development process smoother and your applications more efficient.

Key Highlights of Rails 8.0

Active Support
  • Rails 8.0 has cleaned up deprecated methods, like removing support for passing arrays of strings to ActiveSupport::Deprecation#warn, to streamline codebases.

  • The new escape_html_entities option in ActiveSupport::JSON.encode allows finer control over JSON encoding. You can now render JSON without escaping HTML entities directly in your controller:


  class MyController < ApplicationController
    def index
      render json: { hello: "world" }, escape_html_entities: false
    end
  end

  • ActiveSupport::TimeWithZone#inspect now uses ISO 8601 format, making time representation consistent and predictable.
Active Model
  • The new :except_on option for validations allows you to specify contexts in which validations should be skipped. For instance:

  class User < ApplicationRecord
    validates :birthday, presence: { except_on: :admin }
  end

  • Simplifies password reset implementations with built-in token generation:

  class User < ApplicationRecord
    has_secure_password
  end

  user = User.create!(name: "david", password: "123", password_confirmation: "123")
  token = user.password_reset_token

Active Record
  • This feature allows non-blocking database operations, significantly improving performance by enabling concurrent query execution.

  • Better support for PostgreSQL, including asynchronous query compatibility and schema management improvements, makes Rails more robust for complex database interactions.

Action View and Pack
  • Updates include renaming methods like text_area to textarea, aligning Rails with standard HTML naming conventions while maintaining backward compatibility through aliases.
Deployment and Railties
  • With Propshaft replacing Sprockets as the default asset pipeline, Rails 8.0 modernizes asset handling, reducing complexity and improving performance.

  • These new defaults reduce dependency on Redis, making it easier to deploy Rails applications without external message broker dependencies.

For beginners, Rails 8.0 provides a simpler, faster framework that streamlines tasks and boosts performance, like easier model validations for specific cases.

Asynchronous queries provide a significant speed boost, particularly useful when building scalable applications.

Getting Started with Rails 8.0

To start using Rails 8.0, ensure your development environment is ready by installing the latest Ruby version. Then, update to Rails 8.0 using the following command:


gem install rails -v 8.0.0

Quick Summary

Here is a quick look of Rails 8.0 Release Highlights and Key Improvements:

Active Support

  • Removal of Deprecated Features
  • Improved JSON Handling
  • Enhanced Time Management

Active Model

  • Contextual Validation
  • Default Token Generators

Active Record

  • Asynchronous Queries
  • PostgreSQL Enhancements

Action View and Pack

  • Simplified Form Handling

Deployment and Railties

  • New Deployment Tools
  • Solid Cable and Solid Queue

If you're upgrading an existing application, carefully review the Rails 8.0 release notes to address deprecated features and necessary migration steps.

Rails 8.0 is a big upgrade with tools that make web development simpler and more powerful. Start exploring the new possibilities it brings to your projects.

Follow for latest news and updates.


Comments(0)