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

Rajan Bhattarai

Full Stack Software Developer! πŸ’» 🏑 Grad. Student, MCS. πŸŽ“ Class of '23. GitKraken Ambassador πŸ‡³πŸ‡΅ 2021/22. Works with Ruby / Rails. Photography when no coding. Also tweets a lot at TW / @cdrrazan!

195 posts •
Ruby 3

Object Freezing and Immutability in Ruby β€” When to Lock Things Down

Mutability is the default in Ruby β€” most objects can be changed after creation, which is convenient right up until you have a hash shared between two parts of a system and one

Rajan Bhattarai Rajan Bhattarai 11 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
Developer tips

Developer Mentorship β€” How to Give It, How to Get It, and Why It Compounds

Most developers improve in relative isolation β€” working through problems alone, picking up patterns from code they read, slowly accumulating judgment from things that went wrong. It works, but it’s slow. Mentorship compresses

Rajan Bhattarai Rajan Bhattarai 11 min read
Ruby-code

Generate All Permutations Of An Array In Ruby

Produce every possible ordering of array elements using Array#permutation.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby 3

Symbol#to_proc and Callable Objects in Ruby β€” Making Code Do the Talking

Ruby has several ways to represent callable behavior β€” blocks, procs, lambdas, and method references β€” and the syntactic sugar that connects them is one of the language’s quieter strengths. The &:symbol shorthand

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
Developer tips

Writing Technical Documentation Developers Will Actually Read

Most technical documentation gets written once and ignored forever. Not because developers don’t want documentation β€” anyone who’s spent an afternoon reverse-engineering an undocumented API knows how much it matters β€” but because

Rajan Bhattarai Rajan Bhattarai 11 min read
Ruby-code

Check If Two Strings Are Anagrams In Ruby

Determine whether two strings contain the same characters in any order.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby 3

Enumerator and Lazy Evaluation in Ruby β€” Processing Large Collections Without Blowing Memory

Most Ruby developers reach for map, select, and each without thinking twice β€” and for small arrays, that’s totally fine. But the moment you’re working with large datasets, external files, API paginated responses,

Rajan Bhattarai Rajan Bhattarai 12 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
Developer tips

Git Workflow Best Practices β€” The Habits That Keep Teams Moving Fast

Git is the one tool every developer on a team shares, which makes how you use it either a productivity multiplier or a constant source of friction. The mechanics are easy to learn;

Rajan Bhattarai Rajan Bhattarai 11 min read
Ruby-code

Rotate An Array By N Positions In Ruby

Shift array elements left or right by N positions using Array#rotate.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby 3

Regular Expressions in Ruby β€” A Practical Guide That Skips the Theory

Regular expressions have a reputation for being write-only code β€” you craft them with intense focus, they work, and three months later neither you nor anyone else can read them. That reputation is

Rajan Bhattarai Rajan Bhattarai 8 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
Developer tips

How to Actually Ship Your Side Project β€” The Developer's Guide to Finishing

The developer graveyard is full of side projects. Half-built apps, promising ideas that reached MVP and no further, abandoned repos with commits from two years ago. Starting is easy β€” the problem is

Rajan Bhattarai Rajan Bhattarai 10 min read
« Newer Posts Page 9 of 13 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! πŸš€