26 Mar 2006

Rails Newbie Bootstrapping Guide

Help! What is rails, anyway?

Aren’t those for trains?

Wondering what the “Ruby on Rails” thing is, and wondering if you might like it, but feeling lost when people say you should “just gem install rails and the database server of your choice”? You’re probably at the right place.

This post aims to be a guidebook that help you find the obvious (and not so obvious) online and real-world resources you need to get going with Ruby on Rails. Even if you don’t really understand web development, the resources listed here will help you come to an understanding of web sites, web development, Ruby, and Ruby on Rails.

If there are any steps on this list that you already know, just skip them and move on to the next section and you should be fine. Okay, here we go.

The Vast Internet Wasteland

Before you learn Rails, you’ll need to have a pretty good grasp of some other things. The biggest ones are HTML/XHTML and CSS, the foundational standards of the world wide web. A good place to start learning about them is at the Mozilla Foundation’s introduction to HTML and CSS tutorial. Once you’ve completed those tutorials, you should have enough of an understanding to experiment, learn things, and move on to Ruby and Rails.

If you want a more in-depth treatment, or like dead-tree reference material, try the books on the subject published by O’Reilly publishers: HTML & XHTML and Cascading Style Sheets.

Make Your Choice

Once you’ve got a grasp on the basics of web pages, you can choose whether you want to learn Ruby or Rails next. Although Rails makes heavy use of Ruby, you can still construct relatively simple webapps without knowing Ruby. I’ll put the Ruby material first, but feel free to skip them and come back to them later, when you want to do more complicated programming inside Rails.

Ruby

Making programmers smile, all over the world

To learn Ruby, there are two main starting points: Why’s Poignant Guide, and Programming Ruby: The Pragmatic Guide. The Poignant Guide to Ruby is a very readable (and amusing) introduction to the Ruby language. Why has also written an interactive website that allows you to start writing ruby programs without even installing it on your computer, called Try Ruby Programming Ruby is more straightforward (pragmatic, even), and approaches Ruby more systematically. The complete text of the first edition is online, and is a great resource for getting started.

Once you’ve become acquainted with Ruby, you’ll probably want to refer to the Ruby language documentation and the Ruby Standard Library Docs.

For further reading, reference, and physical-experience addicts, the second edition of Programming Ruby (updated for Ruby 1.8, the latest) is available as a paper or PDF book at the Programming Ruby website.

Rails

“Finally,” you’re thinking, “the actual thing I wanted to learn about in the first place.” And here it is. Ruby on Rails has been praised in many ways, so I won’t repeat any of that here, but you can find out a lot about it at the Ruby on Rails homepage.

Once you’ve got Rails installed on your computer, and you’ve read the documentation that came with the installer package, start with a very basic introductory tutorial, like Rolling with Instant Rails. Next, try a tutorial with a bit more content, like Four Days on Rails or the “Creating a Depot” chapters of the excellent Agile Development with Ruby on Rails book.

Agile Development with Rails is the authoritative book on the subject, and also contains an excellent reference section on the various parts of the Rails framework. It was co-written by Dave Thomas (author of Programming Ruby) and David Heinemeier Hansson (creator of Ruby on Rails). It is well written, easy to read, and very thorough. Go buy it.

To learn more about Rails, you can read ADwR (all of it, not just the tutorial section), watch the Rails screencasts that show just how easy it is, read Rails Recipies, and (you really should do this the whole time you’re learning) write applications in Rails yourself.

Deployment

This is so cool! Where do I put it?

Having made it all the way, and written you new cucumber-life-process-tracking application, you are now probably wondering how you let everyone else on the internet benefit from your hard work. For that, you’ll need a webhost that supports Rails.

I recommend TextDrive, as they are not only amazingly skilled and helpful, they will even contribute a portion of each payment you make to the Ruby on Rails team if you ask them to. If you set up an account with them, there is a manual for setting up Rails apps on TextDrive, and a Capistrano deployment task that attempts to automate sending your Rails app to your TextDrive account.

If you want to explore your options, check out Ruby on Rails Web Hosting, where they have a writeup of several webhosts that support Ruby on Rails and Planet Argon Rails hosting.

Lastly, of course, you could be one of those people who simply has to host their application on their own server. In that case, you probably want to check out FLPR (FreeBSD, Lighttpd, PostgreSQL, Rails), or The Perfect Rails Debian server (Debian, Lighttpd, Mysql, Rails), depending on your distribution.

At this point, you should be able to write Rails applications, upload them to your webhost, and show everyone you know what cool and amazing things you’ve done. If you have any questions, corrections, suggestions, or other feedback, please leave a comment. Thanks, and good luck!