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

Rails

We cover Rails 6.x / 7.x

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
Rails

Service Objects in Rails — Keeping Controllers Thin Without Losing Your Mind

Fat models, skinny controllers was the mantra for years. Then models got fat and we realized that was wrong too. Business logic crammed into ActiveRecord models means models responsible for database persistence, validations,

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

Turbo Frames — Partial Page Updates in Rails Without Writing JavaScript

Turbo Streams handle real-time updates pushed from the server. Turbo Frames handle a different problem: replacing sections of a page in response to user interaction — clicking a link, submitting a form —

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

Rails Credentials — Managing Secrets Without Leaking Them

Every Rails app has secrets — API keys, database passwords, third-party service tokens. The bad old pattern was storing these in environment variables set manually on each server, or worse, hardcoded in config

Rajan Bhattarai Rajan Bhattarai 7 min read
Rails

Action Mailer — Sending Emails in Rails Without the Headaches

Email is one of those features every app eventually needs and nobody particularly wants to build. Welcome emails, password resets, weekly digests, transactional notifications — the list grows quickly once your app is

Rajan Bhattarai Rajan Bhattarai 7 min read
Rails

Active Storage — File Uploads in Rails Without the Ceremony

File uploads have a reputation for being one of those features that look simple and turn out to be a multi-day project. Pick a storage backend, configure credentials, handle direct uploads, generate variants,

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

Stimulus.js — Adding Interactivity to Hotwire Without a Frontend Framework

Turbo handles navigation and real-time updates beautifully — page transitions, stream updates, frame replacement, all without writing JavaScript. But there’s always that next layer of requirement: a dropdown that opens and closes, a

Rajan Bhattarai Rajan Bhattarai 8 min read
Rails

Solid Queue — Background Jobs in Rails 8 Without Redis

For years, the default answer to “how do I run background jobs in Rails?” has been: add Redis, add Sidekiq, configure two separate services, monitor two dashboards, and don’t forget to handle Redis

Rajan Bhattarai Rajan Bhattarai 9 min read
Rails

Real-Time UI Updates with Turbo Streams in Rails 7 and 8

Real-time features used to mean reaching for ActionCable, writing JavaScript event listeners, and managing WebSocket state that lives entirely outside your Rails stack. Turbo Streams changed that equation entirely. Built into Rails 7

Rajan Bhattarai Rajan Bhattarai 7 min read
Rails

Exploring the New Basic Authentication Generator in Rails 8

Rails 8 introduces a built-in authentication generator, streamlining the process of adding basic authentication to Rails applications.

Rajan Bhattarai Rajan Bhattarai 5 min read
Rails

Optimizing N+1 Queries in Rails

In the realm of Ruby on Rails development, the N+1 query problem is a notorious performance bottleneck.

Rajan Bhattarai Rajan Bhattarai 5 min read
Rails

Security features in Rails 7 & 8

Ruby on Rails has long been recognized for its emphasis on security, offering developers a robust framework to build secure web applications.

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