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:

Getting Bootstrap working with Webpack

Rails 6 introduced webpacker, which they encourage use of now over the legacy asset pipeline. This article explains how to get bootstrap, which is used by almost all applications, working with webpacker in Rails 6.

Customizing will_paginate Link Styles in Ruby on Rails

The will_paginate gem is useful in situations where you need to add paging support to a long list of results, such as an Orders list. By default, will_paginate looks a little rough without any styling love. Here are the most useful styling tricks to save you some time.

Social Login in Ruby on Rails with Devise and Google

Social login/registration options can make for a smoother user experience, so they are almost always integrated into Mintbit applications. This article explains how to add a login option through Google and the security measures required to keep your private keys secure in the environment.

Multitenant Rails Application using acts_as_tenant and Devise

There are many use cases for achieving multitenancy in a Rails application. Two of the best gems to use for this purpose are apartment and acts_as_tenant. Both work well and are commonly used. Here are some tips for using acts_as_tenant along with Devise, the most common user authentication gem, to create a multitenant Rails application

RSpec: Moving to Request Specs from Controller Specs

Mintbit always keeps an eye on changelogs from Ruby, Rails and many commonly used gems, and tries to follow the recommendations and avoid deprecations.

Rails Current Attributes: Usage, Pros and Cons

Rails introduced ActiveSupport::CurrentAttributes in version 5.2. Since its addition there has been a lot of discussion about it, with advocates both for and against it making valid points. The merits of ActiveSupport::CurrentAttributes actually depend heavily on how it is used.

Continuous Integration in a Ruby on Rails 6 application with Github Actions

Assume you have a large or mid-level organization where a repository is shared by multiple developers and they often push the code during a day. Let’s say, a developer was building a feature and was coding in a class/module that was being called by ten other places, coded by other developer(s). Let’s also assume that he has completed his feature, tested it and it’s ready for production and it is pushed to the repository and deployed. But he might not be aware of the fact that he has changed the code that was being called by several other modules, and now, let’s say if not all, 2 to 3 of the places are broken and no one knows about it until end-user hits the problem, report it, then the developers fix the code for those 2 to 3 places, this might end up causing problems in other places where it was being called, and you end up in total chaos and it also multiplies the cost of development.

Continuous Integration in a Ruby on Rails 6 application with Github Actions

Assume you have a large or mid-level organization where a repository is shared by multiple developers and they often push the code during a day. Let’s say, a developer was building a feature and was coding in a class/module that was being called by ten other places, coded by other developer(s). Let’s also assume that he has completed his feature, tested it and it’s ready for production and it is pushed to the repository and deployed. But he might not be aware of the fact that he has changed the code that was being called by several other modules, and now, let’s say if not all, 2 to 3 of the places are broken and no one knows about it until end-user hits the problem, report it, then the developers fix the code for those 2 to 3 places, this might end up causing problems in other places where it was being called, and you end up in total chaos and it also multiplies the cost of development.

Refactoring Rails Application according to SRP with Interactors

Software development practices change with time and the practices that were used before are being continuously replaced by some new practices that we call “Best Practices”. In this article, we will discuss something similar that is related to refactoring the code in a Rails application following SRP (Single Responsibility Principle).

Integrating Cloudinary with Active Storage in Rails 6

Just about every application inevitably needs to support file uploads of some kind. For example, a user might need to associate a profile picture with their bio, or notes may be more helpful if attachments could be attached, etc. Cloudinary can be a great choice, as it’s quick and easy to implement, and handles a lot of the heavy lifting for us, including integration with various cloud storage providers.

Keeping Your Gems in Check

A common approach to modern Ruby on Rails development includes continuous integration checks, such as: