FirstDEV blog
  • Home
  • Ruby
  • Ruby On Rails
  • Tips
  • Solutions
  • About
Subscribe

Rails

We cover Rails 6.x / 7.x

Rails

Rails Routing Deep Dive — Namespaces, Constraints, and Patterns Worth Knowing

Rails routing gets treated as the part you set up once and forget. For most CRUD resources, resources :posts and moving on is exactly right. But as applications grow, routing decisions start to

Rajan Bhattarai Rajan Bhattarai 9 min read
Rails

Turbo Streams — Real-Time Page Updates in Rails Without Writing JavaScript

Turbo Streams are the part of Hotwire that makes Rails feel genuinely modern for collaborative, real-time features. Where Turbo Frames handle navigation and scoped updates on the current user’s page, Turbo Streams broadcast

Rajan Bhattarai Rajan Bhattarai 10 min read
Rails

ActiveRecord Transactions and Locking — Keeping Data Consistent Under Concurrency

Database transactions are one of those topics where knowing the basics is easy, but knowing when the basics aren’t enough is harder. ActiveRecord::Base.transaction wraps database operations in an atomic block — either everything

Rajan Bhattarai Rajan Bhattarai 9 min read
Rails

Rails Concerns — When They Help, When They Hurt, and What to Use Instead

Concerns are one of Rails’ most polarizing features. On one hand, they’re built-in, well-supported, and solve the real problem of reusing code across models and controllers. On the other hand, a codebase full

Rajan Bhattarai Rajan Bhattarai 9 min read
Rails

Action Mailer in Rails — Production-Ready Email Without the Footguns

Email in Rails looks deceptively simple — generate a mailer, write a template, call deliver_later. The basics take ten minutes. The production footguns take longer to find: emails sent synchronously blocking requests, views

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

N+1 Queries in ActiveRecord — Diagnosis, Eager Loading, and When Preloading Backfires

N+1 queries are one of those problems that makes perfect sense once you understand them, and that silently degrades production performance until a request that touches 500 records starts taking four seconds. The

Rajan Bhattarai Rajan Bhattarai 10 min read
Rails

Active Storage — File Uploads and Attachments in Rails Without the Complexity

File uploads have a reputation for being the feature that always requires a gem, a CDN configuration, and half a day of setup. Active Storage, built into Rails 5.2+, changes that. It handles

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

Rails 8 Authentication Generator — Built-in Auth Without Devise

Authentication is one of those problems that sounds simple and isn’t. Devise has solved it for Rails developers for over a decade — but it’s also a dependency that ships with opinions, a

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

Stimulus Controllers — Adding JavaScript Behavior to Rails Views Without a SPA

The appeal of server-rendered Rails has always been that you write less — less duplication between client and server, less state management, less JavaScript infrastructure. But “less JavaScript” doesn’t mean no JavaScript. Dropdowns

Rajan Bhattarai Rajan Bhattarai 9 min read
Rails

Solid Queue — Background Jobs in Rails 8 Without Redis

For years, adding background jobs to a Rails application meant adding Redis. Sidekiq is excellent, but it pulls in a dependency that needs its own infrastructure, its own monitoring, its own operational overhead.

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

ActiveRecord Validations — Custom Validators and the Patterns Worth Knowing

Rails ships with a solid set of built-in validations that cover the common cases. Most applications, though, quickly accumulate requirements that built-ins can’t express cleanly — business rules about date ranges, format constraints

Rajan Bhattarai Rajan Bhattarai 9 min read
Rails

Polymorphic Associations in ActiveRecord — One Model, Many Parents

Some models naturally belong to many different types of things. Comments belong to posts, but also to videos, to products, to events. Images attach to users, articles, and listings. Tagging works across everything.

Rajan Bhattarai Rajan Bhattarai 9 min read
Rails

Action Cable Channels and Broadcasting — A Practical Setup Guide

Most Rails apps start request-response and stay that way. Then a product requirement lands — live notifications, a chat feature, a dashboard that updates without refreshing — and suddenly you’re looking at WebSockets.

Rajan Bhattarai Rajan Bhattarai 10 min read
Rails

ActiveRecord Scopes and Query Objects — Keeping Your Queries Organized

Queries scattered across controllers, models, and background jobs are one of the most common maintainability problems in Rails apps. A where clause written inline in a controller is invisible to the next developer

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

Rails Caching Strategies — From Low-Level Cache to Russian Doll

Caching is how Rails apps go from “works fine with 10 users” to “works fine with 10,000 users” without rewriting everything. Rails ships a complete caching toolkit — low-level key-value cache, fragment caching,

Rajan Bhattarai Rajan Bhattarai 9 min read
« Newer Posts Page 2 of 3 Older Posts »
FirstDEV blog © 2026
Proudly published with Jekyll & using Jasper2
Latest Posts Twitter
FirstDEV blog

Check viewARU - Brand Newsletter!

Newsletter to DEVs by DEVs - boost your Personal Brand & career! 🚀