New book - The Imposter's Roadmap! Join the Presale

Revisiting Rails

I have been using various JavaScript frameworks for my site, bigmachine.io, since 2017. That changed in March of 2024, when I threw it all out and rewrote my site using Ruby on Rails.

This is a premium course

And it's amazing and you'll love it, I promise (and guarantee it).

Buy Standalone  Subscribe

course image
Introduction

We'll take a look at my site, bigmachine.io, and I'll discuss some of the reasons why I chose to use Rails.

course image
Baby Steps: Homepage

Reviewing the basics is always a good thing! Let's setup a home page and review how routing works with Rails.

course image
How Tailwind CSS Works with Rails

Tailwind CSS comes with its own compiler, and scans your template files for the Tailwind classes you're using. It does this for efficiency, but wow it can be confusing!

course image
Tests and Tools

Rails gives you a ton of utility, but I like doing things my own way. In this video, we'll set up Make, our scripts directory (which we'll use later), and a .env file for our secrets

course image
Our First Scaffold

Rails is famous for its scaffolding system and was the very first thing DHH demo'd on stage all those years ago. Are they still useful? I think so! Let's see why.

course image
Setting Up Spina

Installing Spina is reasonably straightforward, but there are some nuances (like routing) that you'll need to understand.

course image
The Spina Layout

There's no styling to your pages when you install Spina, which is a good thing, as you'd probably throw it out right from the start. Let's see how to add some style to our site now that our CMS is up and running.

course image
Defining Parts of a Page

Working with any CMS involves concepts and jargon that are nondescript and overused, and Spina is no different. In this video we'll get to know what Parts are, and how they fit into Pages.

course image
Creating a Sales Page: The Repeater

There a few ways to structure a more complex page with Spina, so let's use the example of a long form sales page and see what we can make!

course image
Creating a Sales Page: The Layout

In my explorations, I found that using Repeaters for each section of my page was the most flexible option, though, yes, probably not what was intended.

course image
Importing Data With Migrations

If you're trying to port existing data into Spina, Rails migrations might be your best choice. You can read records from an existing database, your existing CMS, a CSV or a JSON dump.

course image
Making Your Own Embed

The Trix editor is, in a word, "basic". It's also extensible, which comes in very handy when you want to do things like add code samples and Vimeo videos.

course image
In The Real World

We've cover most of the Spina concepts which should set us up for success. That said, you will probably not want your entire site controlled by this package.

course image
Installing Devise

When it comes to authentication, most people in the Rails world use Devise. Let's install it and see how it works.

course image
Using Passwordless Login

I don't like storing passwords, even if they're hashed. You don't like remembering them, so let's setup a simple email link system.

course image
Logging Out and Registering On the Fly

Let's see how to logout with a single click, and what might get in our way. We'll also ensure that users can register on the fly.

course image
Adding Social Login With OmniAuth

Social login is imperative for web and mobile applications, so we're going to plug in OmniAuth, allowing our users to authenticate with Google and GitHub.

course image
Integrating Devise and Spina

Logging in twice is a pain! Let's ditch the Spina auth system and use our own Devise one.

course image
Flexing Make

I love using Make, especially when it comes to working with my database. 

course image
Using Scaffold With Existing Data

Scaffolding is a major productivity booster with new applications - but you can also use it to speed up your rewrite with existing data.

course image
Scaffolding Everything

Now that we understand scaffolds, let's create some for the main tables in our database.

course image
Many to Many Associations

Many to many associations are common in the database world, and working with them on forms (and with models) can be a pain. Rails makes this easy.

course image
Editing Many to Many Records

Rails gives us some great helpers that save so much time, and you're about to meet one of them: collection_check_boxes.

course image
More Complex Many to Many

Some many to many relationships are a bit more complex, such as relating customers to products through invoices (for instance). Let's see how to do this in Rails using a "has many through" relationship.

course image
A Look at Rails Tests

Testing in Rails is extremely simple - the generators do a lot of it for you! In this video we'll have a look at what these generated tests look like.

course image
Filtering Routes

Controllers have a set of "hooks", if you will, called filters. You can run code before, after, or both.

course image
Some Tips and Tools

Let's close out The Rewrite section with some tips and tools. Some of you might be using MongoDB, or just not dig the ActiveRecord pattern. This is OK.

course image
Deployment Considerations

How and where you deploy your site is a highly subjective thing, based on cost and experience. I'll share what I do, just for fun.

course image
Setting Up A Dokku App and Database

Setting up Dokku is all about executing some remote commands. In this video, we'll set up our app container and database, and finally push our existing tables and data.

course image
Preflight Check

We're just about there! Our app container and database are setup, now we just need our code to live on the server.

course image
The First Deployment

If you've worked with Rails, you probably know that the first deployment is usually a matter of herding 100 or so cats. Still the same.

course image
Setting Up S3 CDN

We don't want our CMS images served from our disk in production, so we need to set up a CDN. I'll use S3 as that's what I know.

course image
Wrapping Up

We're all done - but was it worth it? Being honest: both yes, and no.