FirstDEV blog

⚞ Well, Blog First!

  • Home
  • Ruby
  • Ruby On Rails
  • Tips
  • Solutions
  • About
Subscribe
Developer tips

Keeping Dependencies Updated — bundle outdated, Dependabot, and When to Hold

There are two failure modes and teams pick one without deciding. Either nobody updates anything until a CVE forces a jump across four major versions in a week, or Dependabot opens eleven PRs

Rajan Bhattarai Rajan Bhattarai 11 min read
Rails

Multi-Tenancy in Rails — Row-Level vs Schema-Level, and the Cost of Each

Every B2B application eventually needs tenant isolation, and the decision gets made early — usually by whoever writes the first migration, usually without a discussion. Three months later you find out whether it

Rajan Bhattarai Rajan Bhattarai 11 min read
Developer tips

Common Mistakes Rails Beginners Make (and How to Fix Them)

Every one of these ships to production regularly, and none of them are signs that someone is a bad developer. They’re mistakes Rails makes easy — the framework optimises for getting something working

Rajan Bhattarai Rajan Bhattarai 10 min read
Ruby 3

Safe Navigation, dig, and fetch — Choosing the Right Nil Guard

user&.profile&.address&.city looks defensive and reads as careful code. It’s also a sentence that says “I don’t know which of these can be nil, so I’ve assumed all of them can” — and when

Rajan Bhattarai Rajan Bhattarai 11 min read
Rails

Rails Form Helpers and ViewComponents — A Practical Guide

Your form markup is forty lines per field: a label, an input, a conditional error span, three utility classes, an aria attribute someone added once. Multiply by eleven fields and six forms and

Rajan Bhattarai Rajan Bhattarai 11 min read
Developer tips

Sharing Code Snippets That People Can Actually Use

Someone asks for help and you paste forty lines into Slack. It wraps at column sixty, loses its indentation, and scrolls off the channel in an hour. Or you paste a screenshot of

Rajan Bhattarai Rajan Bhattarai 10 min read
Developer tips

RuboCop in a Legacy Codebase — Safe Rollout Without the 4,000-File Diff

Someone adds RuboCop to a six-year-old Rails app, runs it, and gets 47,000 offences. The obvious next move — rubocop -A and commit — produces a diff touching every file in the repository,

Rajan Bhattarai Rajan Bhattarai 11 min read
Ruby 3

StringScanner — Parsing Text Without the Regex Overhead

There’s a stage in every text-parsing problem where the regex stops being the right tool. You’ve got a pattern with four alternations and three lookaheads, it’s slow, it’s unreadable, and it still can’t

Rajan Bhattarai Rajan Bhattarai 11 min read
Rails

Understanding Zeitwerk — Rails' Autoloading Engine, Explained

uninitialized constant Billing::PDFGenerator on a file that unmistakably exists at app/services/billing/pdf_generator.rb. Or a class that loads fine in development and vanishes in production. Or a change to a model that doesn’t take effect

Rajan Bhattarai Rajan Bhattarai 10 min read
Developer tips

Setting Up Pre-Commit Hooks for Ruby Projects

A pre-commit hook that runs your full test suite gets bypassed with --no-verify within a week, and then it may as well not exist. A hook that catches a committed binding.pry in 200

Rajan Bhattarai Rajan Bhattarai 11 min read
Developer tips

Pair Programming Tips for Remote Developers

Remote pairing has a bad reputation earned mostly by bad sessions: three hours on a call, one person driving the whole time, the other watching a laggy screen share and drifting into Slack.

Rajan Bhattarai Rajan Bhattarai 12 min read
Rails

Request Specs vs Controller Specs — What to Test at Each Layer

Controller specs let you call an action directly and assert on assigned instance variables. They’re fast, they’re focused, and the Rails team has been steering people away from them for years. The reason

Rajan Bhattarai Rajan Bhattarai 10 min read
Ruby 3

Decorators in Ruby — Delegation Patterns That Don't Fall Apart

You want to add display logic to a model without putting it on the model. So you reach for SimpleDelegator, wrap the object, add three methods, and it works — until something calls

Rajan Bhattarai Rajan Bhattarai 10 min read
Developer tips

Writing Error Messages That Help — What to Include and What to Skip

Invalid configuration. That’s the whole message. Somewhere in a 300-line YAML file there’s a problem, and the program knows exactly which key, which line, and what it expected — it just chose not

Rajan Bhattarai Rajan Bhattarai 11 min read
Rails

Bulletproofing Rails Migrations — Zero-Downtime Strategies for Large Tables

rails db:migrate on a forty-row development database takes eleven milliseconds. The same migration against a forty-million-row production table takes an ACCESS EXCLUSIVE lock, queues every query behind it, exhausts the connection pool, and

Rajan Bhattarai Rajan Bhattarai 11 min read
Page 1 of 10 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! 🚀