RSSAmplifier

Blog

RailsNotes, the Ruby on Rails guides you wished you had.

The Ruby on Rails guides you wished you had, when you were first starting out. Read interesting articles about Hotwire, Stimulus, ActionMailer, Databases, Deployment and more.

railsnotes.xyzRSS feed ↗29 posts

Latest posts

Run RSpec specs in parallel (with the parallel_rspec gem)

Run RSpec in parallel and speedup your specs by 2x-4x locally using the handy parallel_rspec gem.

Internal product analytics with Ahoy

Learn how to use the Ahoy gem to track feature usage within your Ruby on Rails apps.

Exploring the Blazer gem

Learn how to use the Blazer gem in your Ruby on Rails app to query data in SQL, build dashboards, and run automated checks.

Stealthly Web Scraping in Ruby with Ferrum

Learn how to setup Ruby and Ferrum for stealthy web scraping and browsing, including setting up correct headers, proxying requests, rotating your user agents, restricting bandwidth usage and more.

Using Rails debugger/rdbg with VS Code

A short introduction to the rdbg/debugger extension for VS Code, plus a guide on how to set it up correctly to debug your Ruby on Rails applications, as well as your RSpec specs. The VS Code extension takes 5 minutes to setup and it's great!

A decent VS Code + Ruby on Rails setup

Setting up VS Code for Ruby on Rails development can be tricky, so I wrote this article to help. In it, I share different VS Code extensions for things like autocomplete, linting, formatting and more! I've even put together a handy extension pack to get you setup fast.

Here's what's coming in Rails 8

Work on Rails 8 is starting, so I dug through the official GitHub milestone to break down all the upcoming goodies for you. There's plenty coming, including Solid Queue, Solid Cache and Kamal becoming defaults, better support for PWAs, an official LSP, and more!

Edit Rails Credentials using VS Code

This short guide shows you how to use VS Code to edit secrets in your Ruby on Rails app when you run `rails credentials:edit`. I also include a handy `bin/credentials:edit` script to simplify things.

ActionMailer attachments in Ruby on Rails

ActionMailer makes it easy to attach files to your emails. In this article, I show you how to attach single or multiple files, set custom encodings and mime_types, and attach images as inline attachments to display in your email body.

Some ViewComponent tips (how I write them)

In this article, I share tips for writing Rails ViewComponents, based on my experience building RailsNotes UI, and other projects. If you use ViewComponents in your Ruby on Rails apps, read this article!

Refactoring from feature specs to system specs

In this article, I break down the difference between system specs and feature specs in RSpec and Rails, and walk you through refactoring your feature specs to system specs.

Build dynamic navs with current_page? (and conditional classes)

This article explores a dynamic nav component I built using the current_page? helper method, plus Rails' conditional class helpers. The result? A simple, dynamic navbar component, with different styling based on current page. Plus I threw in the ViewComponent version too 😉

Add a favicon to your Rails app in 2 minutes

This is a super short article on how to add a favicon to your Ruby on Rails app. We combine the favicon_link_tag helper with asset_path, which makes it quick and easy.

A simple Stimulus Tabs Controller

In this article, I share a handy Stimulus controller for adding tabs to your Rails apps. I also show you a different variation of the controller, and how to add it to your views. Plus, I've included a handy tip to avoid the annoying "flashing in" effect that can happen if you're not careful.

Preview Rails mailers with letter_opener, MailCatcher and MailHog

This article covers everything you ever wanted to know (and more) about previewing emails and ActionMailer templates in Ruby on Rails. I cover native ActionMailer previews, the letter_opener gem, MailCatcher and MailHog. I've tested them all, and I cover how to use them, and their pros and cons.

Skip the console with Rails Runner

If you're sick of typing rails console all day, or just want to learn about a cool Rails command, I've got something that you're going to like — the rails runner command.

Split your database seeds.rb by Rails environment

This method to split your database seeds by Rails environment is clean and simple, and is perfect to split up your `seeds.rb` file. It's a brilliant method! I just wish I'd thought of it first 😅

Overmind 🪬, a better bin/dev for your Procfile

Overmind is a Procfile manager on steroids — like Foreman and bin/dev, but... a lot better. It's deeply configurable, and integrates with tmux so you can stop, restart and attach to running processes.

Simple Lazy Loading in Rails with Hotwire and Turbo Frames

Hotwire and Turbo Frames make it easy to add lazy-loading into our Rails apps — I'm talking only 12 lines of code! Plus, we can use TailwindCSS to create a skeleton loader for our Turbo Frames.

Seed your database with the Faker gem. Then seed 9.4x faster with upsert_all and activerecord-import.

We use the faker gem to seed our database with 10,000 fake posts. Then, we're going to speed up seeding by 9.4x, using either upsert_all or the activerecord-import gem.

Rails Generate Migration (handy reference)

A handy reference for generating migrations in your Ruby on Rails app — I cover the basics like adding columns and tables, adjusting column types (and loads more), plus some tips and tricks...

Adding Redis and Sidekiq to your Ruby on Rails app

Here are the basics of installing Redis and Sidekiq, and then adding Redis and Sidekiq to your Ruby on Rails app. This is everything you need to get set up — no fluff, just a couple of commands. Let's go!

Procfile.dev, bin/dev, and Rails 7 — how they work, why they're great.

Rails 7 introduced a lot of new things, but honestly, the `bin/dev` script is the thing I notice the most. I want to try to give your some insight into how `bin/dev` and `Procfile.dev` work together...

Deploying Ruby on Rails with Dokku (Redis, Sidekiq, ARM servers and Docker).

This is the ultimate Dokku + Ruby on Rails guide — I cover running Dokku on x86 and ARM, deploying Sidekiq and Redis, dockerizing our Ruby on Rails app, and more...

Your first Stimulus Controller — Learn Stimulus in Ruby on Rails by building a toggle.

So, you're new to Stimulus and want to try it out in your Ruby on Rails app. Or perhaps you just need a simple toggle pattern to follow. Either way, you're in the right place...

Learn Hotwire by building the simplest possible Hotwire and Ruby on Rails app — a beginners guide.

Most Rails apps probably don't need a React or Vue frontend. With a few lines of Rails and Hotwire magic, we can build a live frontend. That's what we're going to be doing today...

Replace .env with Rails Credentials in your Ruby on Rails app

A deep dive into the basics of Rails credentials, explore their benefits and drawbacks, and showing you how easy it is to integrate this powerful tool into your Rails app development process...

From API calls to ActionMailer — Refactoring a Rails App to Use ActionMailer for transactional email

How I switched from using direct SendGrid API calls to implementing ActionMailer for cleaner, more manageable code. Our final implementation will take us from 36 lines of code, down to 1 ...

Deploying a Ruby on Rails App on Render with a Database, Redis, Sidekiq, and Cron Jobs

A full guide for deploying a Ruby on Rails app to Render with a database, Redis, Sidekiq, and Cron jobs. This guide steps you through deploying your Rails app to Render, including setting up Redis, Sidekiq and Cron jobs to give you a great production-ready starter.