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

Rails

A collection of 29 posts

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
Rails

ActiveRecord Callbacks — When to Use Them and When to Stop

ActiveRecord callbacks are one of Rails’s most convenient features and one of its most misused. before_save, after_create, after_commit — they let you hook into the model lifecycle and run code automatically, which sounds

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

Rails API Mode — Building JSON APIs Without the Full Stack Overhead

Rails started as a framework for server-rendered HTML applications, and it still excels there. But a significant portion of Rails apps today are pure JSON APIs — backends for mobile apps, frontend JavaScript

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

Action Cable — Real-Time Features in Rails with WebSockets

Turbo Streams handle real-time updates elegantly for most cases — server broadcasts a change, the page updates. But Turbo Streams build on top of Action Cable, and sometimes you need to work at

Rajan Bhattarai Rajan Bhattarai 8 min read
« Newer Posts Page 2 of 4 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! 🚀