category: Ruby on Rails

Use Pundit as a Rails Feature Flag System

Posted on June 21, 2021 - 5 Minute Read

In this tutorial, I'll show you how to create a feature flag system in Rails using pundit and a column on the table. Step 1: Initial Setup…

Read More

Real-time Form Validation in Ruby on Rails

Posted on May 08, 2021 - 7 Minute Read

Learn how to validate a form in real-time while conditionally preventing it from being submitted. demo Step 1: Initial Set Up Step 2: Add…

Read More

Create an infinite scrolling blog roll in Rails with Hotwire

Posted on March 21, 2021 - 6 Minute Read

In this tutorial, I'll show you how to add an infinitely scrolling blog roll using Rails and Hotwire. Note that this is different than Chris…

Read More

Generate Link Previews in Rails with Microlink

Posted on February 23, 2021 - 8 Minute Read

In this tutorial I'll show you how to leverage the Microlink API to generate link previews in Ruby on Rails. Demo Step 1: Application Set…

Read More

Auto Save Form Data in Rails

Posted on January 31, 2021 - 6 Minute Read

In this tutorial I'm going to show you how to automatically save form data in Rails. Instead of saving a draft to the database, we'll simply…

Read More

Easily find elements with XPath in Capybara by using Chrome's Dev Tools

Posted on July 31, 2020 - 1 Minute Read

Imagine you have multiple identical elements on a page and that you need to select a specific element during a system test. If your test…

Read More

Install Bootstrap 4 on a Rails 6 App with Webpacker

Posted on July 30, 2020 - 4 Minute Read

I know many existing tutorials explain how to install Bootstrap 4 on a Rails 6 application with Webpacker (like the GoRails example…

Read More

Configure Travis CI for Ruby on Rails

Posted on June 10, 2020 - 4 Minute Read

In this tutorial I am going to show you how to configure Travis CI to run your Rails' test suite and system tests everytime you push a new…

Read More

PaperTrail Gem Tutorial

Posted on April 20, 2020 - 22 Minute Read

Introduction In this tutorial I am going to show you how to revert and restore records using the PaperTrail Gem. Reverting Old Versions…

Read More

Obfuscate Numerical IDs in Rails

Posted on March 22, 2020 - 3 Minute Read

By default, Rails displays the record's in the URL (e.g. ). Although there is nothing inherently wrong with this approach, sometimes it's…

Read More

Ruby on Rails with React Tutorial

Posted on February 21, 2020 - 70 Minute Read

Introduction Many Rails+React tutorials demonstrate how to create an API only application using Rails, and then create a separate front-end…

Read More

Create a Nested Form in Rails from Scratch

Posted on November 10, 2019 - 5 Minute Read

The Rails Guides give a great example of how to create nested forms. However, Rails does not support adding fields on the fly out of the box…

Read More

Rails Ajax Examples (Without jQuery)

Posted on October 26, 2019 - 3 Minute Read

Introduction Rails ships with turbolinks which: automatically fetches the page, swaps in its , and merges its , all without incurring the…

Read More

Why I Think Rails is Still Relevant in 2019

Posted on August 27, 2019 - 6 Minute Read

There is currently a high demand for Javascript developers, which in turn dictates the content and curriculum of many tutorials, articles…

Read More

Create Dependent Associations in FactoryBot

Posted on August 14, 2019 - 2 Minute Read

Imagine the following set of models and relationships: A can add a to a . The has a , and that has a which depends upon the . So I…

Read More

Use a Custom Column Name With a belongs_to Association in Rails

Posted on August 12, 2019 - 2 Minute Read

Imagine an application with the following relationships: A model which through a join table. A model which through a join table. A…

Read More

Configure RSpec and Capybara with Ruby on Rails

Posted on November 25, 2018 - 6 Minute Read

In this tutorial I'm going to show you how to configure your Rails app to use RSpec and Capaybara. In addition, we will also install and…

Read More

Convert a belongs_to Association to a has_many :through Association in Ruby on Rails

Posted on November 22, 2018 - 7 Minute Read

I was tasked with converting a association to a association. The challenge was that the app was live, and there were existing…

Read More