Published: Jul 28th, 2020
Updated: Dec 29th, 2020
I love Ruby on Rails. I think it’s a fantastic framework for web applications. I highly recommend it and I thoroughly enjoy working with it.
I’ve been lucky enough to work extensively with Rails on many different projects over many different years. Most Rails development, like most software development, happens on long-lived projects. A well-established and well-configured project is an absolute joy to work in and collaborate on.
But a new Rails project doesn’t have many of the little tweaks and additions that make things so nice for me. I end up spending a lot of time and frustration repeating the same steps in every application.
This guide is an effort to make those steps faster and easier. The goal is to create a smooth and rapid path from zero to a codebase I love working in.
What This Is Not
This is not a beginner’s guide
I will explain things as simply as I can, but there will likely be some important information left out. If you do not understand a recommendation, you might not understand the consequences.
This is not something to apply blindly
Examine every bit of the advice herein to see if it is right for you, your project, and your team before applying it. That’s what the annotations are for.
This is not static
The world changes and I change with it. My preferences and recommendations are in constant flux. This guide will change with them.
This is not an automated setup script
There is no point in automating something that will change every time you do it.
If you want an automated setup script, take a look at Suspenders. It is a Rails template created by Thoughtbot with their standard defaults. They make a lot of good choices, some of which I will certainly draw from.
Table of Contents
A guide to make working with your Rails application more productive and joyful.
Use the right version of Ruby for the job.
Creating a brand new Rails application.
Use version control to make changes with confidence.
Remove problematic language from your Git setup.
Accurately record changes made while pairing by adding multiple authors to your commits.
If your code is open source, make sure people know.
Ensure a safe and welcoming environment by adopting a code of conduct.
Switch over to a production-ready database.
Make it easy to continuously keep your libraries up to date.
Make your HTML templates easier to work with.
Make your cascading style sheets easier to work with.
Use a clear and expressive testing framework.
Make it easier to test object attributes.
Make the Rails generators generate the code you want. No more, no less.
Database keys that can’t be guessed, don’t overflow, and don’t leak information.
Make your Ruby style consistent.
Make your Ruby style beautiful.
Avoid common Rails mistakes and correct them automatically.
Find security issues in your libraries before the bad guys do.
Find security issues in your code before the bad guys do.
Avoid using libraries with licenses you do not want to agree to.
Run all of your automated checks with a single command.
Deploy your Rails application.