The Rails New Command
Published: Aug 11th, 2020
This is part of Joyful Rails, a list of recommendations to make developing your Rails app more productive and joyful.
In this article, we are talking about the Rails “new” command.
The Rails “new” command is used to create a brand new Rails application. It creates a directory with the framework and all the boilerplate code installed.
It takes a lot of files with a lot of code to have a working Rails project. Rather than make you create and write them all yourself, Rails has a command-line interface that will create them for you.
If you do not have the Rails gem already, install it with
gem install rails.
If you already have the Rails gem, you can update it with
gem update rails.
Make sure you are using the version of Rails you want to be using with
--version. You can see the latest version of Rails on the
To create a new Rails project run:
rails new projectname.
The Rails gem will create a new directory named
projectname and create a new
Rails project in that directory.
The Rails “new” command accepts a lot of options to change the default behavior. Many of them make a lot of my later recommendations unnecessary. I haven’t included them here for a couple of reasons.
First, I don’t know what they are.
But more importantly, I advocate for putting off decisions whenever possible. It’s easy to get caught in the trap of trying to figure out the exact right set of options to use to create your new application. I’d rather create my Rails app with the default settings and change things easily in the future when (and if!) the need arises.