Ruby on Rails 101

This post was originally written by one of our team leaders, Joe Fiorini, for his blog. It is reposted here to help our volunteers get setup to code away.

Have you been looking for some good resources to help you get started using Ruby on Rails? Look no further. This article contains links to the best resources on developing in Ruby on Rails. I start from setting up your environment (Windows/Ubuntu) and continue through learning the Ruby language, and finish with how to automate testing of your application.

Although I don’t personally develop Ruby on Rails web apps on Windows, I know a number of developers who do. Therefore, I’m releasing a guide with links to explanations, tutorials, etc. for getting started with Rails in a Windows environment. If you don’t use Windows, please peruse the guide anyway. I believe you will find many useful links. If you find this guide useful, please recommend me on Working with Rails. Please note: as of this writing (2/24/2010) the current Ruby on Rails version is 2.3.5.

First off, here’s an older introduction to Rails. I recommend this because it also explains some Rubyisms that aren’t immediately obvious to someone coming from another langauge. It also hase an excellent overview of the tools used when writing a Rails app.

Starting Ruby on Rails: What I Wish I Knew

For more information on using Rails check out RailsGuides. This site gives a complete overview of all the Rails components you need to worry about.

After you check that out, here are a couple guides to getting configuring your environment:

After you have configured Rails, you will probably want something better than Notepad for editing your code. Fortunately, you have some options.

  • RubyMine – Remember ReSharper? Well, the awesome team over at JetBrains is at it again with the RubyMine IDE. Try it out!
  • NetBeans – Another awesome IDE, but this one s free & open source. Make sure you download the Ruby edition.
  • E-TextEditor – If you’ve seen Mac people using TextMate, this is a very similar editor for Windows. In fact, you can directly use TextMate Bundles in e. For anyone looking for the “just an editor” experience (esp. those currently locked in IDE prison) I recommend this editor.

Now that you’ve installed Ruby and Rails and found an editor, I highly recommend getting to know the Ruby language a bit. While it may seem okay to just learn Rails, knowing the difference between the language and the framework will help you find in fix bugs, among other things, much faster. Here are some guides for learning Ruby.

  • Why’s Poignant Guide to Ruby – By far the wackiest programming language introduction I’ve ever seen! Why has a very original, and entertaining approach to teaching the Ruby language. Warning: while this guide is excellent, it can be distracting for some. Give it a try and if you don’t like it, try something else!
  • Programming Ruby – The Pragmatic Guide to Ruby. This is a free, online book that should teach you all you need to know!
  • Learn to Program – Does the term “Object Oriented” confuse you? Try this book by Chris Pine available from The Pragmatic Bookshelf
  • The Ruby Way – If you’re looking for the ultimate guide to the Ruby language, look no further than Hal Fulton’s The Ruby Way.

You know that “unit testing” thing programmers like to harp about? Since Ruby is an interpreted language, there is no compiler. This makes unit testing doubly important to ensure that your code works as you expect it. Fear not, developer friends. Ruby makes unit testing quite simple.

  • Rails Testing Guide – This is a guide from RailsGuides. It covers the basics of testing your Rails apps.
  • Getting Started With Rails TestingNoel Rappin teaches the basics of testing your Rails applications in this free e-book.
  • FactoryGirl – Take the section from the previous link on fixtures, and replace it with FactoryGirl. Factories are a much better way to handle loading test data than fixtures. Be sure to read the FactoryGirl README.
  • Shoulda – Shoulda is an extension to Ruby’s test/unit (shown in the first link) to give better syntax and macros for testing your Rails applications.
  • Rspec – Rspec is a library that gives you a behavior-basd DSL for testing your Ruby on Rails applications.
  • Cucumber – An English-language acceptance testing library for Ruby and Rails applications. Highly recommended for anyone even before learning Test/Unit or Rspec.
  • Rails Prescriptions – Once you get comfortable with testing your Rails apps, this book provides answers to some more advanced questions.

I hope this guide helps you in getting started on your Rails journey! If you have any questions, comments, suggestions, or gripes please leave a comment.

About these ads

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: