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

Reload in ruby and when to use it.

Consider we have a model student when we access data from this using the following command. The variable student contains the data of a student. Each student has enrolled in many courses, which is another model. On printing the student, we get the following data Consider if I update the course model, The expected behavior…

Tech

with_options in rails

I have recently encountered this method, which saved my time and helped me follow the DRY principle Use case: Consider a scenario, you have a list of trains and you have to apply filters on like depature_time, arrival_time, train_number, arrival_station, depature_station, number of coaches, etc. For that, you have to write interaction. The input will…