ruby

Functions in Ruby that make life easy.

I have been using ROR for the last eight months and started loving this language because of the poetic way it allows me to write the code. In this journey, I have found some functions which helped me to keep the code short and improved readability significantly. 1. blank? and present? A common use case…

ruby

Writing my first monkey patch in rails

The motivation From last few months we are facing an error which have become hard to replicate in development environment. The error is This error occurs rarely and replicating have become hard. The idea was to log the query and see why the query is forming correctly. Then I used, query.to_sql to log the query…

ruby

Adding Caching Helper in Rails

When a particular API processing slow or performing a heavy calculation or have heavy DB queries. One of the solution to optimize the API that comes to our mind is to cache the response for appropriate amount of time. This will help us to improve the performance by overcoming the mentioned issues. It is also…

database

How Data is stored in Relational Database

It’s important to understand how database stores data internally, understanding this allows us to understand why a query runs fast or slow. Before diving in, let’s clear out some computer fundamentals, all the data on a computer is stored as streams of 1s and 0s as blocks/pages on the drive, Databases use these blocks and…