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

Rajan Bhattarai

Software Engineer by work! ๐Ÿ’ป ๐Ÿก 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!

14 posts •
Ruby-code

Find Intersection Of Arrays Or Sets Cleanly In Ruby 3

Ruby 3+ provides elegant ways to find common elements between arrays, sets, or enum collections using intersection (&) or Set#intersection. This is especially useful for filtering, authorization checks, tag matching, or data deduplication.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby-code

Group Array Elements By Multiple Attributes In Ruby

Grouping records by a single attribute is straightforward using Enumerable#group_by. But what if you want to group by multiple attributes, such as categorizing records by both type and status? This method handles that

Rajan Bhattarai Rajan Bhattarai 1 min read
Rails-code

Deeply Remove All Nils And Empty Values From A Nested Hash In Ruby

When handling deeply nested hashes or API payloads in Rails, itโ€™s common to deal with nil values, empty arrays, or hashes that need to be cleaned before storage or transmission.

Rajan Bhattarai Rajan Bhattarai 1 min read
Rails-code

Convert An Array Of Single Key Hashes Into An Attribute Hash

You may encounter a situation where you have an array of single-key hashes and need to restructure it into a grouped hash based on the keys.

Rajan Bhattarai Rajan Bhattarai 1 min read
Rails-code

Normalize Input Parameters By Symbolizing Keys And Stripping Empty Strings In Ruby

When working with user-submitted forms or API input, itโ€™s common to receive params with string keys and empty string values.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby 3

Exploring Endless Method Definitions in Ruby

Ruby has a reputation for flexibility and expressiveness, often encouraging developers to explore boundaries that many other languages restrict.

Rajan Bhattarai Rajan Bhattarai 8 min read
Authetication

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
Documentation

The Right Way to Write Documentation for Codebases

Effective documentation is crucial for the success and maintainability of any codebase. It serves as a roadmap for developers, aiding in understanding, collaboration, and future development.

Rajan Bhattarai Rajan Bhattarai 8 min read
Ruby 3

Mastering Rubyโ€™s Closures - Blocks, Procs, and Lambdas Explained

As seasoned Ruby developers, we often leverage the languageโ€™s expressive syntax and powerful features to write clean and efficient code.

Rajan Bhattarai Rajan Bhattarai 6 min read
Optimization

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
Git

How to write better Commit messages

In collaborative software development, commit messages serve as the narrative thread that weaves together the evolution of a codebase.

Rajan Bhattarai Rajan Bhattarai 5 min read
Ruby 3

How Keyword Arguments Work in Ruby 3

Ruby 3.0 introduced significant changes to how keyword arguments are handled, aiming to enhance clarity and reduce ambiguity in method calls.

Rajan Bhattarai Rajan Bhattarai 4 min read
Security

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
Remote work

Pair Programming tips for Remote Developers

In the evolving landscape of software development, remote work has become increasingly prevalent.

Rajan Bhattarai Rajan Bhattarai 4 min read
FirstDEV blog © 2025
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! ๐Ÿš€