Back to Code (Starting a new Rails App)


This was written a couple of weeks ago, when I started a new personal project after taking a few weeks off from coding:

I started building my new Rails app today. Man, am I rusty! I had to look up how to create a new app, generate models, create routes, all of it. I suppose I have only done it a couple of times before, so I shouldn’t be too hard on myself, but I’m feeling a bit like a fish out of water. And without the ever present comfort of EDA instructors hovering nearby to help whenever I get stuck. How will I do this all by myself?! At least there isn’t a deadline, ‘cause this is going to take a WHILE.

But to look on the bright side, at least I’m back at it. The band aid has been torn off, I’ve dived right in and as slow as it may go, I am on my way. One step at a time. Trying not to get ahead of myself by thinking of next steps and worrying, ‘Shit, how am I going to do that? Or that? or THAT??’ I’ll deal with those things when I get there.

The best part is that despite feeling tentative and unsure, I am really, really glad to be coding again.


Getting Started on a new Rails app

If you haven’t done it much before, starting a new Rails app can be a bit daunting. Luckily for me, as a student of EDA, I had access to handy instructions that guided me through the setup phase. Luckily for everyone else, there is a lot of great resources and assistance available online. Not surprisingly, one of the best are the RailsGuides themselves, in the section called, ‘Getting Started with Rails’. They make it pretty easy to just follow along step-by-step to get the ball rolling with your own project, including how to install Ruby and Rails.

I’ll just add a couple of pointers that I’ve learned in my limited experience:

1. Based on my EDA instruction, I specify that I want the database to be PostgreSQL when I create my new Rails app. I also specify that I don’t want to use Test Unit.

The command looks something like this:

rails new project_name –database=postgresql –skip-test-unit

As I mentioned, we were taught to do it this way in EDA, but it makes sense to me.

Rails will automatically include Test Unit if you don’t specify otherwise, and I prefer to use RSpec (I love RSpec. I love testing. I am a nerd. For more info about RSpec, visit here), which I will add to the GemFile and bundle install later. Rails will also automatically include SQLite for the database if you don’t specify otherwise. We were taught that PostgreSQL is better for production and it is best to make your development environment as close to production as possible.

2. As soon as I’ve created the new app, I make it a git repo (command: git init), save, commit and push it up to GitHub. I suppose you don’t have to do this, but using some kind of source control was so ingrained in us as students that I don’t think twice about it. Even if it is my personal, just-for-fun project and I only work in master (shock! gasp! horror!), I still save and commit the crap out of it. A good habit, I believe.

3. A gem like Rails Composer is an application template that creates a starter app for you. It comes with built-in things like Bootstrap and OmniAuth and all kinds of other awesomeness – you get to pick and choose from a seemingly neverending list in the initial setup. It sounds like a great idea in theory because it takes care of so much for you. However, I tried it once and I found – particularly as a newbie – that I got a bit lost in the sheer volume of files it created, the purpose of 90% of which I had no idea about. I believe it is better to start out with Rails building things from the ground up, so you have a good understanding of where everything is and what it’s doing, before jumping into using something like Rails Composer.

These are just a few things to consider when starting a new Rails app. Please feel free to comment below and add anything you feel is missing. New tips are always appreciated!


One thought on “Back to Code (Starting a new Rails App)

  1. Oh like this! I am exactly at this place now after graduating from EDA. Have just started a project and had all the same feelings you did! Always great to hear that other people are or have struggled like I am!

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s