Skip to content

Instantly share code, notes, and snippets.

@brianburridge
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianburridge/096537cc15146cb765fa to your computer and use it in GitHub Desktop.
Save brianburridge/096537cc15146cb765fa to your computer and use it in GitHub Desktop.
Getting Started with Ruby on Rails

Getting Started with Ruby on Rails

To get into Ruby on Rails web development, there are some tools and basic skills you will need.

Why use a Mac?

The Mac, in my opinion, is the preferred platform of choice for Ruby on Rails developers. If you attend any Ruby conference you will see the majority of attendees use a Mac, probably around 90%. The others will be primarily Linux users. There may be some scattered Windows users, but the Windows platform is not an easy one to use as a Ruby developer.

The Mac operating system runs on top of Unix, which makes it an ideal system for Rails developers to use, since so much of the software we need is Unix based. It also provides a stable, rich UI platform for some very helpful applications. Installation has been made very simple compared to other platforms.

As well, since so many Rails developers have adopted the platform, you'll find it much easier to find help online with setting up and troubleshooting your system.

The Minimum Tools You'll Need

All of the tools listed below are completely free and all of them run on the Mac.

The Ruby and the Rails framework

Ruby is an object-oriented programming language initially created to be a scripting language like Perl, but object oriented. It was created by Yukihiro "Matz" Matsumoto of Japan, and first released in 1995.

By itself, Ruby isn't intended to create web applications. David Heinemeier Hansson, of 37 Signals, created a framework on top of Ruby to create their company's first product, Basecamp. He then released the framework as open source, in 2004, calling it Ruby on Rails, and it has grown into one of the largest web development frameworks in the world.

If you are interested in trying out Ruby to see how it works, I recommend the free Try Ruby course from Code School. To see a bit more about Rails you could also take their free Rails for Zombies class.

Note: the Zombies Rails course uses an older version of Rails, but it's still a good place to start and have some fun at the same time.

Terminal

Terminal is a Mac OS application which provides the user with command line access to the underlying Unix operating system on a Mac. It is good to become familiar with using the Terminal, because as a Rails developer, this is where you will spend the bulk of your time.

Here you will create folders, use version control, push your code out to a server, run scripts to modify your database, and many other functions to make changes to your Rails application. This is also where you run all the Ruby applications, including starting up your Rails application.

There are a number of good resources for gaining experience and familiarity with the Terminal. Here are a few I recommend:

Atom for writing code

A text editor application is needed in order for you to write code, much like Pages or Word helps you write publishable or printable text. You need to write code, as plain text (which is why you can't use a desktop publishing application), so you can save it to your file system to later run it, or share it with other developers and servers.

There are many text editors available for Ruby developers, both free and paid. I personally feel that the Atom editor, provided by GitHub, is the best of the free ones for those just getting started with development.

My personal editor of choice is an IDE (integrated development environment) called RubyMine. IDE's provide much more complex and helpful features than a standard text editor. They are also generally not free, and can have a steep learning curve. This is why I start my class out with Atom for the first six weeks, before introducing them to RubyMine.

You can download and install Atom from here.

Once you have downloaded and installed it, I highly recommend installing Atom's command line tools. To do so, inside Atom, click 'Atom' in upper left, then click on 'Install Shell Commands'.

Git for version control

Experienced developers have learned the hard way, the pain of losing a large amount of code you've put so much effort into. As you work on your software, it won't be long before you'll want to collaborate on it with other developers. Using version control will help you accomplish both, as well as provide a number of other benefits. There have been many different version control systems over the years, but at least in the Ruby community, git is the standard by far.

Git will allow you to frequently "save" your work to what's known as a repository. This repository will maintain a history of all your versions. You can browse this history and even rollback your code to previous versions. This can be a huge time saver and save the developer much stress.

All of this versioning, and the accompanying features, take place right on your Mac, even without an Internet connection.

The best place to get started with understanding Git, is a free tutorial called Try Git, provided by Code School.

GitHub

Eventually, you'll want to share the code from your local git repository with other developers. You may want their opinion, their help, or simply to share it for prospective clients or employers to see. To do this, you have to push your code out to a git server.

Years ago, this meant setting up your own server with git on it. This confifugration was not trivial in time spent, and there is definitely a steep learning curve for a beginner.

Thankfully, GitHub, and it's competitors, provide git servers you can use for a small monthly fee, or even for free, if you don't mind your code being visible to everyone.

You can sign up for a free GitHub account at their web site. The service is free to use if you choose to make your code public. If you are creating an application you hope to profit from, you will probably want to pay for a private account, for a small fee each month.

GitHub also provides many other helpful features in developing applications and collaborating with a team of developers. They have provided a short tutorial to introduce you to those features called Hello World.

Heroku for live application hosting

Once you have created a Ruby on Rails application on your computer, and you want to begin letting other users try it and test it out, you'll need to copy your code out onto a server. We call this process deploying your code. In order to have a server to deploy your code to, there is usually a large amount of work to provision, or setup, a new server.

Thankfully there are services, like Heroku, that do most of that work for you, provide helpful tools, and generally eliminate a majority of the work in both provisioning a server and deploying your code. Heroku is my favorite. I have deployed almost 50 applications to their servers over the years, including one of Miley Cyrus's sites in 2013. Heroku and that Rails app was able to easily handle 12 million visitors per minute. So, there's no worries about Heroku handling busy web applications.

You can sign up for an account at Heroku, for free, on their site.

What do do next

Install and Setup Your Development Environment

Now that you are familiar with the minimum tools and technologies necessary to begin writing web applications with Ruby on Rails, you'll need to install Ruby, Rails and git.

There are several steps involved, but the step-by-step tutorial found at InstallRails makes it very simple for beginners. It is what I use with all my new students.

You can choose your operating system (hopefully you've wisely selected to get started on a Mac), and then the version of your operating system. From there just follow the step by step instructions.

On Mac, it will have you install Homebrew, which is a very helpful tool to install many command line applications. I recommend doing every step as they indicate, except for the "Install Sublime Text". Simply skip this step, if you are using Atom as discussed above.

Sublime Text is another text editor. However it is not free to use long term. You can certainly choose to use it instead of Atom if you wish. But I believe Atom is a little easier, and certainly cheaper, for just getting started.

Become familiar with some basic Rails terms and concetps

I've written a blog post covering some basic Rails terms and concepts. Although it was written in 2007, everything still applies, and will ensure you are familiar with these very important concepts. You can read it here.

Further Rails Instruction

There are several courses online, free and paid, that you can use to gain further experience and knowledge with both Ruby and Rails.

Many make the mistake of jumping into Rails too soon and ignoring the Ruby programming language itself. While that may be tempting, it's crucial you gain a very firm foundation in Ruby and Object Oriented Programming.

Presumably you've already done the Try Ruby course mentioned above. The next two "courses" I would recommend you spend time with are the Ruby Koans and Learn Ruby the Hard Way.

Ruby Koans step through Ruby functionality, from basic to advanced, in a testing format. This is also a good way to get your brain to start thinking in terms of testing, a big part of the Ruby on Rails framework and conventions.

With Ruby Koans, you'll download the code to your system and then run the tests. There are close to 300 of them. They will all fail, and your goal is to walk through each test, one at a time and get them to work by putting in the approproate Ruby code. Doing this exercise will help you better understand how Ruby works.

If you get stuck, you might Google for answers, look in Ruby documentation, or move to the Learn Ruby the Hard Way book. This book can be purchased or read for free online (see the link above).

The two of these, along with Try Ruby, should give you a very solid introduction to coding with Ruby.

Code School, which provides the Try Git and Try Ruby courses previously referred to, also offers many more courses on all the technologies needed to be a Ruby on Rails developer. They cover Ruby, Rails, Git, Javascript, HTML/CSS, and others. There is a monthly fee to access their courses, but it's a wonderful resource to continue your leanrning.

Another alternative, or addition, to Code School is Go Rails. Go Rails offers many online tutorials and screencasts for a minimal monthly fee.

Hands On Mentorship

If you are like most people, online courses and tutorials can only take you so far. They are a great way to get your brain moving in a programming direction, get your feet wet, and ensure you actually have a passion for writing software.

But what if you do? What if you want to make this a career? I've found that dedicated focus for a consistent period of time, working with an experienced and skilled mentor, is best way to make substantial, lasting progress in the shortest amount of time.

This is where The Iron Yard can be a great next step for you. At The Iron Yard, we offer a 12 week intensive bootcamp with an experienced teacher and mentor. You will be taught everything you need to know to get a job as a Junior Fullstack Ruby on Rails developer.

The focus is on teaching you to think, analyze, break down problems and find solutions like a developer. It's one thing to memorize Ruby and Rails syntax, but if you don't understand the princples behind object oriented programming and software development, you can only get so far.

If you are interested in learning more about The Iron Yard, visit our website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment