Effectively Human
Published in

Effectively Human

Kickstarting a Rails Project

A practical guide for new Rails 5.2 projects

I love learning how others work. Hoping to glean some wisdom or insight that could help me sharpen my skills, I’m constantly reevaluating what works best. Regardless of the nature of the rails application, I’ve found the following workflow to be quite helpful. Having built my personal site on Rail 5.2, I can confirm that each gem still works and this workflow continues to be relevant.

Preliminary Notes and Assumptions

Order matters. Installing each gem in the following order optimizes for their generator workflow. A few of the gems build nicely on top of one another. Reorder at your own discomfort.

RailsCasts are old, but helpful. It’s been years since Ryan Bates published a new RailsCast or updated an old one, but the content is still helpful. As long as you can fill in the cracks between rails versions, it’s Rails gold.

This is not an environment setup guide. This workflow assumes you already have appropriate Ruby and Rails versions installed on your machine. If you’re looking for a setup manual, this is not it. Google ‘setup ruby on rails’ for help.

Getting Started

Run ‘rails new app_name -T -d postgresql’

Beginning with the end in mind, setting a postgresql database over the Rails default will make Heroku deployments a lot simpler. Also, -T will skip the default test suite so we can install Rspec later.

Make sure to swap ‘app_name’ for your actual app name. I understand this may seem obvious, but if you’re a copy-paste-madman this may seem less obvious.

rails new app_name -T -d postgresql

Install ‘rspec-rails’

I waited too long to throw my weight behind writing tests. If you’re not there yet either, I’m not going to use this time to convince you: skip to ‘install haml’.

If you are interested in exploring or are a TDD junky, rspec is a great place to start.

Documentation: https://github.com/rspec/rspec-rails

Install ‘factory_bot’

If rspec, then use factory_bot too. Formerly known as factory_girl, factory_bot allows for the simple setup of Ruby objects for testing. Building baseline information for each object, writing tests becomes a matter of manipulating those objects, not rewriting from the ground up.

Documentation: https://github.com/thoughtbot/factory_bot

Install ‘haml-rails’

You can learn more about HAML, but suffice it to say your code starts to look more like poetry. HAML is shorthand, indentation based markup that consolidates and expedites the code you write.

Documentation: https://github.com/indirect/haml-rails

HTML to Haml Converter: http://htmltohaml.com/

Install ‘simple_form’

Simple Form extends Rails ‘form_for’ helper and adds a level of sophistication. Combined with HAML, Simple Forms keeps form lean and limits the useless repetition.

Disclaimer: Installing Simple Form after haml-rails will ensure appropriate scaffolds are also built. Failing to do so will cause the generator to continue to build forms without the ‘simple_form_for’ helper.

Documentation: https://github.com/plataformatec/simple_form

RailsCast: http://railscasts.com/episodes/234-simple-form-revised

Install ‘friendly_id’

Friendly Id allows for clean, readable urls. With the added benefits of obscuring an object’s ID and aligning more closely with Google keywords, friendly_id is a simple, powerful tool.

Documentation: https://github.com/norman/friendly_id

RailsCast: http://railscasts.com/episodes/314-pretty-urls-with-friendlyid

Install ‘devise’

Devise is a flexible authentication solution that is consistently updated and battle tested. With a vibrant community and extensions like devise_inviteable and oauth, I have never been presented with a compelling enough reason to use anything else.

You could build your own airplane to get to California, or you could just book a flight on Delta.

Disclaimer: Follow their documentation and the command line feedback after install. If you skip some steps on setup, you could experience from frustration upon deployment.

Documentation: https://github.com/plataformatec/devise

Rails Cast: http://railscasts.com/episodes/209-devise-revised

Update generator preferences

Rails generators are great, but sometimes they need to be scaled back a bit. A quick update to the config/application.rb can cut down on the clutter and reduce the amount of code cleanup required.

# Configure Generators
config.generators do | g |
g.assets false
g.helper false
g.jbuilder false
g.stylesheets false
g.test_framework :rspec

Documentation: http://guides.rubyonrails.org/generators.html#customizing-your-workflow

Install ‘ahoy_matey’

Analytics for Rails. Admittedly, I discovered this tool while building out a recent Rails 5.2 project. Unlike the other gems in the list, Ahoy is a new tool that isn’t fully vetted. Having used a number of other tools over the years, Ahoy immediately overcame my largest objections to those tools.

I’m currently working through some pains around querying with Ahoy, but other than that, it has been pretty great.

Documentation: https://github.com/ankane/ahoy


After you’ve run through the workflow above, it’s time to start building your custom software. From here, with each new migration or generate command, the initial heavy lifting should be done.

If you have thoughts, hit me up on Twitter: @morganjlopes

If you have code related questions, tap me on stack overflow: @morganjlopes




Thoughtful learnings and shared insights along the road of designing for humans and developing for computers. By the team members (and friends) of Polar Notion. Est 2012.

Recommended from Medium

TIP- Automate — Fetch HDFS Location for Hive Table

Lesson 3; Strings

Hygiene — The Key to Engineering Success

Autogenerate GraphQL documentation with Magidoc


Recapitulation of Centaurify PROJECT AMA event held at AMA LOVERS CLUB.

Working part time in an Agile organisation

Paperless Factory: here are some ideas

Microsoft Azure DevOps plugin for Android Studio

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Morgan J. Lopes

Morgan J. Lopes

CTO at Fast Company’s World Most Innovative Company (x4). Author of “Code School”, a book to help more people transition into tech.

More from Medium

How do Rails Polymorphic Tables work Anyway?

Foundation Code Camp lastday.

Handling Race Conditions in Rails Application

How Pry taught me how to OO Ruby

The legendary Bobby Tables