Rails 7.2 Release: A New Chapter for Ruby on Rails

yosemite

In August 2024, Ruby on Rails 💎 released Rails 7.21, a significant update bringing a wide range of performance improvements and developer tools. Let’s dive into the highlights:


1. Enhanced Production Defaults

Rails 7.2 is built with better production defaults in mind, focusing on efficiency and speed. One of the biggest changes is the integration of YJIT2, Ruby’s Just-In-Time compiler, enabled by default for applications running on Ruby 3.3 or newer. This promises significant performance gains, improving latency by up to 25% in real-world scenarios.

Another key improvement is the reduction of default threads in Puma, Rails’ default web server, from 5 to 3. This change optimizes how Ruby handles its Global VM Lock (GVL)3, leading to faster request processing with fewer delays.

2. Dev Containers for Easy Development Setup

Development containers have been integrated directly into Rails 7.2, simplifying the development environment setup. By generating a pre-configured container with Docker 🐳, devs can now spin up environments complete with databases, Redis, and headless Chrome for testing. This is perfect for those working in teams or across different machines, ensuring consistency across environments.

To create a new Rails app with a development container, all it takes is a single command:

rails new myapp --devcontainer

3. Improved Guides Design

One subtle but appreciated improvement in Rails 7.2 is the redesigned Rails Guides. The design has been modernized to align with Rails’ homepage, featuring cleaner typography, simplified navigation, and a refreshed look and feel. The goal was to make the documentation as accessible and visually pleasing as the framework itself.

4. Performance and Security

Rails 7.2 improves performance not just with YJIT but also through better memory allocation by including jemalloc in the default Dockerfile. On the security front, Brakeman, a security vulnerability scanner, is now included by default. This addition helps identify potential security issues during development, reinforcing Rails’ focus on secure coding practices.

5. What’s Next: Looking Ahead to Rails 8

Rails 7.2 is a powerful update, but the Rails team is already looking forward to Rails 8, expected later this year. Rails 84 is set to include native Progressive Web App (PWA) support, new deployment workflows with Kamal, and an integrated authentication generator to simplify user authentication in applications.


Conclusion

Rails 7.2 marks a milestone in the evolution of Ruby on Rails, enhancing both performance and usability. The inclusion of features like YJIT, dev containers, and better documentation will make development faster.

  1. https://rubyonrails.org/2024/8/10/Rails-7-2-0-has-been-released ↩︎
  2. https://shopify.engineering/ruby-yjit-is-production-ready ↩︎
  3. https://www.speedshop.co/2020/05/11/the-ruby-gvl-and-scaling.html ↩︎
  4. https://railsnotes.xyz/blog/rails-8-whats-coming ↩︎

Leave a Reply

Your email address will not be published. Required fields are marked *