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

Building a Developer Portfolio That Actually Gets You Hired

Most developer portfolios are a graveyard of half-finished to-do apps and cloned tutorials. Hiring managers have seen hundreds of them. They’re not evaluating whether you know CRUD — they’re trying to answer one

Rajan Bhattarai Rajan Bhattarai 10 min read
Ruby-code

Flatten A Nested Array To A Specific Depth In Ruby

Use Array#flatten with a depth argument to collapse nested arrays to a precise level — avoiding full flattening when partial structure needs to be preserved.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby 3

Range Objects in Ruby — More Than Just Iteration

Most Ruby developers use ranges for iteration and not much else. (1..10).each, maybe ('a'..'z') for alphabet work, perhaps a case condition or two. But ranges in Ruby are full objects with a rich

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

How Open Source Contributions Build Your Developer Career

Open source contribution has a reputation problem. The dominant narrative is heroic: submit a patch to Rails, get merged, become famous. The reality — and the more useful version — is that even

Rajan Bhattarai Rajan Bhattarai 10 min read
Ruby-code

Deep Merge Two Nested Hashes Without Losing Keys In Ruby

Perform a recursive hash merge that combines nested values instead of overwriting them — useful for configuration merging, settings overrides, and building complex data structures.

Rajan Bhattarai Rajan Bhattarai 2 min read
Ruby 3

Struct vs OpenStruct vs Data — Choosing Lightweight Value Objects in Ruby

Ruby gives you three tools for creating lightweight objects without the boilerplate of a full class definition: Struct, OpenStruct, and the newer Data (Ruby 3.2+). Each serves a different purpose, and the wrong

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

Speaking at Your First Tech Meetup — A Practical Guide for Developers

Most developers who could benefit from speaking at meetups never do. Not because they lack something to say, but because the idea of getting on stage feels much larger than it actually is.

Rajan Bhattarai Rajan Bhattarai 11 min read
Ruby-code

Sort A Hash By Its Values In Ruby

Use sort_by to order a hash’s key-value pairs by value, returning a sorted array of pairs that can be converted back to a hash.

Rajan Bhattarai Rajan Bhattarai 2 min read
Ruby 3

Refinements in Ruby — Scoped Monkey Patching Without the Footguns

Monkey patching in Ruby has a reputation — usually deserved — for causing exactly the kind of spooky action-at-a-distance bugs that make senior engineers twitch. Open a class anywhere in the codebase, add

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

How to Get Your First 100 Newsletter Subscribers as a Developer

A newsletter is the most underrated asset a developer can build. No algorithm, no platform risk, no fighting for attention in someone else’s feed. Just you, your readers, and a direct line. The

Rajan Bhattarai Rajan Bhattarai 10 min read
Ruby-code

Group Consecutive Elements In An Array By Condition In Ruby

Use chunk_while to group adjacent array elements that share a condition — perfect for run-length encoding, streak detection, and range grouping.

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