Exciting Updates in Ruby on Rails for September 2024
Written on
Chapter 1: Monthly Newsletter Overview
Welcome to the September edition of the "Ruby on Rails Monthly" newsletter! As we embark on a new month of exciting updates, I want to extend a heartfelt Happy Mother's Day to all the amazing mothers out there. I'm Sajjad Umar, your Desi Developer, here to share the latest happenings in the Ruby on Rails community.
Ruby on Rails Monthly is a reader-supported publication. To stay updated with fresh posts and support my work, consider subscribing, whether for free or as a paid member.
Let's dive into the highlights!
Section 1.1: Create Custom QR Codes
Features:
- Generate QR codes for URLs, Wi-Fi, or plain text
- Incorporate your brand’s logo
- Choose your brand colors
- Download options available for free or high-resolution versions for just $2.99
Section 1.2: Rails Community Survey
The bi-annual Rails community survey has launched its eighth edition, delving deeper into the topics we all want to explore. Participate in the survey [here](#).
Subsection 1.2.1: RailsWorld 2024
Tickets for RailsWorld 2024 sold out in under 20 minutes, with over 1,000 tickets snapped up quickly. If you managed to secure one, consider yourself fortunate! Find all the details [here](#).
Chapter 2: Key Feature Updates
This video discusses whether you should use Ruby on Rails in 2024, providing insights into the framework's advantages and challenges.
Section 2.1: ActiveRecord Enhancements
A significant update allows ActiveRecord::Base#pluck to now accept hash values, enhancing its functionality. Here’s how it works:
Before:
Post.joins(:comments).pluck("posts.id", "comments.id", "comments.body")
After:
Post.joins(:comments).pluck(posts: [:id], comments: [:id, :body])
Read more about this improvement [here](#).
Section 2.2: Performance Improvements
The :n_plus_one_only mode has seen improvements in child association loading. This strict loading mechanism aims to optimize performance during deep association traversals, allowing queries like Person.find(1).posts while preventing costly operations.
This update also rectifies an ordering issue, ensuring that person.posts.first reliably returns the first post in primary key order, enhancing predictability in data retrieval.
Before:
person = Person.find(1)
person.strict_loading!(mode: :n_plus_one_only)
person.posts.first
# SELECT * FROM posts WHERE person_id = 1; -- non-deterministic order
After:
person = Person.find(1)
person.strict_loading!(mode: :n_plus_one_only)
person.posts.first # this is 1+1, not N+1
# SELECT * FROM posts WHERE person_id = 1 ORDER BY id LIMIT 1;
Learn more about these changes [here](#).
Chapter 3: New Features and Fixes
In this video, we explore if Ruby on Rails is still relevant in 2024, assessing its place in the modern development landscape.
Section 3.1: Feature Policy Correction
A minor but crucial fix was made to the Feature Policy for idle-detection, correcting the spelling from idle_detection to idle-detection for proper browser processing. More details can be found [here](#).
Section 3.2: DevContainer Updates
New updates have been implemented to ensure that Node and Yarn are included when creating a Rails project with JavaScript. This enhancement streamlines the setup process for developers.
Additionally, the devcontainer.json file has been modified to automatically forward the necessary ports for your project, eliminating the need for manual adjustments.
Chapter 4: Conclusion
That's all for this month! Stay tuned for more updates and insights in our next edition.
Ruby on Rails Monthly thrives on reader support. To stay informed and support my work, please consider subscribing!