Routing with Friendly IDs in Rails

Imagine you have a fruit shop application built in Ruby on Rails. As a Rails developer, you know that to get to a specific fruit page, a URL like www.myfruitshop/1 will work - but it’s more user friendly to use something like this:

Implementing Ajax in Ruby on Rails

This article will discuss how to implement Ajax in a Rails 6 application. Here’s how to start:

Adding JQuery in Ruby on Rails 6 Applications

As any Ruby on Rails developer knows, webpacker was a major addition in Rails 6. With the introduction of webpacker, Rails applications no longer need asset pipeline. The app/assets/javascript is moved to app/javascript.

Uploading Images from URLs in Rails ActiveStorage

This article will discuss how to attach images to a model from URLs with ActiveStorage.

Conditional Validations in Rails ActiveRecord

Conditional validations can be used when a validation needs to be run only if a condition is satisfied. This can be implemented in many ways, a few of which we will discuss in this article.

How to parse spreadsheets with Roo gem in Ruby on Rails

It’s common to need to read data from .csv or .xlsx files and insert that data into the database. This is a frequent use case in web development. In this article, we will discuss this use case in Ruby on Rails applications.

Using Enums in Ruby on Rails

For Rails developers, using enums with ActiveRecord is always a good choice when you have to manage the state of an object. For example, for an online shop, you may have three states of an order - i.e. received, dispatched and delivered. One option is to add three boolean fields in the database for received, dispatched and delivered, but this approach looks ugly. A cleaner approach is to add a single string column status that includes values of received, dispatched and delivered, then add three methods in the model file.

Authentication with Mobile Numbers in Rails using Devise

Many applications use mobile number authentication instead of email-based authentication. This article will discuss the technique to override default authentication behavior. Here are the steps to authenticate using a mobile number:

Sending SMS in Ruby on Rails Application using Twilio

This article will discuss how to send an sms in a Ruby on Rails application using Twilio.

Optimistic Locking vs Pessimistic Locking in Ruby on Rails

Locking in a database means that no two or more sessions can update the same record at the same time until the lock is released. In this article we will discuss two main types of locking in Ruby on Rails; Optimistic Locking and Pessimistic Locking.

Working with Custom Validations in Rails

This article will discuss a concept known as Custom Validations in Rails Active Record. There are two types of custom validations; Custom Validators and Custom Methods.

Understanding ActiveRecord Transactions

This article will discuss database transactions and how to use them in Ruby on Rails. Transaction in a database means the state of the database will only change if all the statements in a transaction block succeed, otherwise all the statements will roll back and no state change will occur.

Speeding up Rails Applications with Optimized Database Queries

This article will discuss the most basic technique to speed up a Rails application by optimizing database queries.

Searching made easy with pg_search gem in Ruby on Rails

This article will discuss how to make search functionality easier and faster in Ruby on Rails through a gem called pg_search. According to the official documentation:

Polymorphic Association in Ruby on Rails

This article will discuss Polymorphic Association, an important concept in Ruby on Rails.

Single Table Inheritance in Ruby on Rails

This article will discuss Single Table Inheritance in Ruby on Rails.

Understanding ActiveRecord Autosave Association

ActiveRecord AutosaveAssociation is a module that is used for saving the child objects if the parent is saved and deleting the child objects if they are marked for destruction. This article will demonstrate how this works.

Layouts in Ruby on Rails

Often there are situations where there are separate menus/layouts for admin and other pages. This article will discuss layouts in Ruby on Rails. To start:

Using delegate method in Ruby on Rails

This article will discuss a very useful method in Ruby on Rails - ActiveRecord, i.e. delegate. According to the documentation, delegate:

Hash methods every Ruby Developer should know

Hash is a very common data structure used by Ruby developers. This article will discuss some important hash methods every Ruby developer should know.

Array methods every Ruby developer should know

This article will discuss Ruby array methods every Ruby developer should know. These methods are each, map, select, reject, select!, reject!, compact and include?. This article will also discuss the comparison of these methods where applicable.

Passwordless Authentication in Ruby on Rails with Devise

With the increasing number of daily routine mobile/web applications people use, password management becomes an issue. Almost all applications now provide social login, but some people would prefer not to use that method.

Ruby: Safe Navigation Operator to the Rescue

When developing a Ruby on Rails application that involves a user having one address, and the address table having all the address values such address_line_1, address_line_2, etc., the details may need to be shown similar to this:

Adding Trix Editor in Ruby on Rails 6 applications

This article demonstrates adding ActionText to Rails applications. According to the official ActionText documentation:

Adding Tailwind CSS to Ruby on Rails 6 applications

Tailwind is a CSS framework that is quickly gaining popularity over other CSS frameworks. The reason for that, according to the creators of Tailwind: