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

Debugging Ruby with binding.break β€” Ditch byebug, Keep the Flow

Ruby 3.1 shipped debug in the standard library, and it quietly made three gems unnecessary. No byebug, no pry-byebug, no version conflicts between them, and β€” the part that changes how you work

Rajan Bhattarai Rajan Bhattarai 9 min read
Ruby-code

Build A Hash From Two Parallel Arrays In Ruby

Two arrays β€” one of keys, one of values, lined up by index β€” is a shape that comes out of CSV headers plus a row, form field names plus submitted values, and

Rajan Bhattarai Rajan Bhattarai 2 min read
Ruby 3

Hash Methods Worth Knowing β€” transform_keys, transform_values, filter, and merge with a Block

Hashes are the workhorse data structure of most Ruby applications β€” API responses, configuration objects, parameters, aggregations. Ruby’s Hash class has been steadily gaining methods that reduce the boilerplate of common transformations. transform_keys,

Rajan Bhattarai Rajan Bhattarai 10 min read
Rails

Rails Routing Deep Dive β€” Namespaces, Constraints, and Patterns Worth Knowing

Rails routing gets treated as the part you set up once and forget. For most CRUD resources, resources :posts and moving on is exactly right. But as applications grow, routing decisions start to

Rajan Bhattarai Rajan Bhattarai 9 min read
Developer tips

How to Give Effective Code Reviews β€” The Reviewer's Craft

Code review is one of the highest-leverage activities a developer does. A good reviewer catches real problems before they reach production, helps less experienced engineers grow faster, and raises the quality bar for

Rajan Bhattarai Rajan Bhattarai 11 min read
Ruby-code

Transpose A 2d Array Matrix In Ruby

Flip a matrix over its diagonal β€” rows become columns and columns become rows. Ruby’s Array#transpose handles this in one call.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby-code

Memoize Expensive Method Calls In Ruby To Avoid Repeated Computation

When a method performs an expensive operation β€” a database query, an API call, a complex calculation β€” calling it repeatedly wastes time and resources. Memoization caches the result on first call and

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby-code

Deep Merge Nested Hashes In Ruby Without Losing Keys

Ruby’s built-in Hash#merge only merges the top level β€” nested keys get overwritten entirely instead of merged recursively. When working with deeply nested configuration objects or API payloads, you need a merge that

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby-code

Diff Two Hashes And Return Added Removed And Changed Keys In Ruby

When comparing configuration objects, API responses, or form submissions, you often need to know exactly what changed β€” not just whether the hashes are equal.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby 3

filter_map and Modern Enumerable β€” Ruby's Most Useful Recent Additions

Ruby’s Enumerable module has been quietly gaining methods that make common collection operations more expressive without adding complexity. filter_map alone replaces a pattern that every Ruby developer has written dozens of times. Combined

Rajan Bhattarai Rajan Bhattarai 11 min read
Rails

Turbo Streams β€” Real-Time Page Updates in Rails Without Writing JavaScript

Turbo Streams are the part of Hotwire that makes Rails feel genuinely modern for collaborative, real-time features. Where Turbo Frames handle navigation and scoped updates on the current user’s page, Turbo Streams broadcast

Rajan Bhattarai Rajan Bhattarai 10 min read
Developer tips

How to Optimize Your LinkedIn Profile as a Developer (So Recruiters Actually Find You)

Most developer LinkedIn profiles are either a digital resume with bullet points copied from a Word document, or a ghost town that hasn’t been touched since the last job search. Both miss what

Rajan Bhattarai Rajan Bhattarai 11 min read
Ruby-code

Find The Longest Consecutive Sequence In An Array In Ruby

Identify the longest run of consecutive integers in an unsorted array β€” useful for streak detection, range analysis, and data validation.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby 3

Ruby String Methods You're Probably Underusing β€” format, scan, match, and gsub with Blocks

String manipulation is one of those areas where developers develop habits early and rarely revisit them. split, include?, gsub, strip β€” these cover a lot of ground. But Ruby’s String class has methods

Rajan Bhattarai Rajan Bhattarai 10 min read
Rails

ActiveRecord Transactions and Locking β€” Keeping Data Consistent Under Concurrency

Database transactions are one of those topics where knowing the basics is easy, but knowing when the basics aren’t enough is harder. ActiveRecord::Base.transaction wraps database operations in an atomic block β€” either everything

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