6 Great Ruby on Rails 3 Learning Resources

Ruby on Rails 3 was released just a short time ago and is a fairly big changed to previous versions of the Rails framework.   People are starting to put together some great content to help developers come up-to-speed on Rails 3.

I began looking around for some Rails 3 content for my own use, even though I use a variety of beta books for the purpose, I found these resources really useful.  This brought me to the realization some readers may find value.

1. Ruby on Rails Tutorial by Michael Hartl

railstutorial_logoThis is such a great resource; offering a range of content that includes a Ruby on Rails Tutorial book as well as a set of videos with material from the book.  The book is available to read on-line, purchase as a PDF or the dead tree version available from Addison-Wesley.

The videos are a real sweet spot in my opinion, with 15 hrs of video training for $85.  Try to get 2-days of training from anyone at that price.

Table of Contents

  • Rails installation (OS X/Linux) (13m)
  • Git .bashrc lines
  • Rails installation (Windows) (8m)
  • Lesson 1: From zero to deploy (46m)
  • Lesson 2: A demo app (1h11m)
  • OS X testing setup (8m)
  • Lesson 3: Mostly static pages (57m)
  • Lesson 4: Rails-flavored Ruby (1h45m)
  • Lesson 5: Filling in the layout (1h10m)
  • Lesson 6: Modeling and viewing users, part I (1h30m)
  • Lesson 7: Modeling and viewing users, part II (1h40m)
  • Lesson 8: Sign up (1h22m)
  • Lesson 9: Sign in, sign out (1h36m)
  • Lesson 10: Updating, showing, and deleting users (2h25m)
  • Lesson 11: User microposts (2h03m)
  • Lesson 12: Following users (2h19m)

I have gone through both the book, Rails 3 version, and the screencasts looking for nuggets of information I may not be aware of in Rails 3.  The screen casts are presented in a such a well-thought-out manner that makes them easy to follow and will not put you to sleep.

Michael covers a lot of great basic topics but also includes specific coverage of such things as setting up and using Devise for authentication.  He also covers Test-Driven Development (TDD) very well using RSpec.  There are a lot of how-to tips with TDD alone to save you hours.

2. PeepCode: Meet Rails 3 Part 01

meet-rails-3-iI always love the content put out by PeepCode and Geoffrey Grosenbach and his recent Meet Rails 3 Part 01 was no exception.

This screen cast covers the beginning aspects of getting into Rails development both on Mac and Windows.  I was pleasantly surprised to see my blog post Running Rails 3 on Windows was used as a reference for users to setup and use Rails 3 on Windows.

PeepCode has been providing screencasts for a long time and is likely to the first to offer those covering Ruby on Rails.

3. Dive into Rails 3 Screencasts

Episode1The Dive into Rails 3 screencasts put out by Gregg Pollack were probably the first series focused on Rails 3 right around the time Rails 3 was released.

Gregg covers many of the hot topics emerging in Rails 3 today:

These are screencasts talk about what is new in Rails 3, so some knowledge of Rails 2.x would be helpful to get the most out of these.

4.  RailsCasts

railscasts_logoRyan Bates has been making the weekly release of a RailsCast what seems like forever now.  Currently there are 240 episodes up on the site, and by my precise calculations..that’s around 4 1/2 years of  great content.  Most episodes range between 10 and 15 minutes of focused content on a particular topic.

At last count Ryan had 25 screen casts covering different aspects of Rails 3 from the basics to new validations to implementing Devise.  These episodes are laser focused to they are best used with some prior knowledge first, possibly go through the Tekpub or RailsTutorial first.

5. TekPub Rails 3 Series

tekpub_logo_smThe Rails 3 series from TekPub currently has 6 episodes running 5+ hours.  The typical series from TekPub is one that starts off with a single episode with more added over a few weeks.

I have been a Tekpub subscriber since it first opened in October 2009 and love the format of their training.

This series is promoted as:

In this series Rob Conery shows you Rails 3 and the core concepts involved. The focus of this series is a bit more practical than theoretical – with the goal of showing you not only Rails, but many of the tools to help you get your site up and running quickly and effectively.

Rob has a been doing screencasts for a long time and has really honed his voice to be the soothing voice you hear on each episode.  Each episode is on a different topic and covers it very well in the 1 hour dedicated.  As I write this, Rob has 6 episodes:

  1. Why You Should Care About Rails 3
  2. Rack
  3. Controller Fundamentals
  4. Controller Deep Dive
  5. View Concepts
  6. Model Concepts

6. Rails 3 Upgrade Handbook

rails-3-upgrade-handbook-pdf

Long-time Ruby and Rails community member Jeremy McAnally has written up this great handbook on how to take your pre-Rails 3 application into the Rails 3 world.

So many projects exist out in the wild that his handbook is invaluable.

Unlike the other resources I have listed, this is not a screencast but is available as an ebook.   I felt is was just such a great resource for Rails 3 and it tied in so well with coming up-to-speed on Rails 3 and the likelihood you might be upgrading a Rails 2.x application to the latest.

The guide is a beauty, it really covers the pain points a developer will face when upgrading their application to Rails 3 and shows how to get around them.  He includes use of his gem to help with the process as well as checklists for deprecations and the upgrade process itself.

Moving your application to Rails 3?  You need this guide.

Running Rails 3 on Windows

Well, the long-awaited release of Ruby on Rails 3 is now out and all of the Mac and Linux junkies are busy gem-installing the latest version of the framework.  What about all the lonely Windows developers out there looking through their windows (pun intended) and wondering what it’s like on the other side of the fence?

Good news!  It is actually pretty easy to setup and run Rails 3 on your Windows system.  I mainly run on Macs these days but have a couple Windows systems still kicking around and thought I would give a go.  It is actually pretty straight-forward now and works really well.  Follow the steps:

Install Ruby

Rails 3 requires at least Ruby 1.8.7 and is happy using Ruby 1.9.2, I opted for the latest and greatest.

  1. Head over to RubyForge for the Ruby Installer by Luis LavenaDownload 1.9.2-p0 for the latest.   A nice feature of this Ruby installer is the latest gem executable is built in, which is version 1.3.7 at the time of this writing and you won’t have to install it yourself.
  2. I installed in C:\Ruby192, which is the default, and added C:\Ruby192\bin to my path so Windows can find the Ruby executables.

Running the Ruby version command from a new command prompt:

ruby -v

ruby-version

If you get a file-not-found or some other undesirable result then the path setting isn’t likely correct or you may want to try closing the command prompt and opening a new one.

Install Ruby on Rails

This is a tough one:

gem install rails

UPDATE: A reader points out of issues with installing Rails as pointed out by a post on the Ruby Forum. The issue was solved by simply adding a –pre to the gem command to install Rails.

gem install rails --pre

Everything you need to run Rails 3 gets installed with the exception of the SQLite3 Ruby gem which Rails uses as the default database provider:

Rails3gems

gem install sqlite3-ruby

You should see a message similar to this:

sqlite3-ruby-gem

I use SQLite3 for most of my local development unless I need a database like MySQL or PostgreSQL.  Installing is trivial.

Installing SQLite3

If you look at the above message when installing the sqlite3-ruby you should notice the gem relies on the sqlite3.dll and it is recommended to use version 3.6.23.1, which you can download form here.  I grabbed 3.7.2 and it seems to work fine, your mileage may vary.  If you’re interested, get the latest from the SQLite3 downloads page.

Now with the sqlite3.dll in hand (unzipped from the download), copy to the bin directory of the above Ruby installation.  In my case that’s C:\Ruby192\bin, and that’s it.

Creating a Test Application

Now it’s time to test the new Ruby and Rails installation.  Pick a location to create the new application and run the new Rails command from a command prompt:

rails new testapp

This command creates a new directory called testapp and spits out a bunch of text along the way, looking something like this:

railsapp

Once done, change directory into the new testapp directory and run:

rake db:migrate

This will test your SQLite3 installation and create a new development database in the testapp\db directory called development.sqlite3.  If you get any errors it is likely the sqlite3.dll is not in your Ruby bin directory, check and come back.

Now from the testapp directory, fire up the Rails development server from a command prompt:

rails server

WebBrick fires up and looks like this:

rails_server

If there are errors reported than something has gone wrong.  If you see this screen, fire up your browser and browser to the address http://localhost:3000.  If all goes well, you will see this screen:

testapp_home

Click on the link below the title that reads “About your application’s environment”.  This gives a lot of detail about your Rails application configuration.

testapp_config

Congratulations!  You have the latest and greatest Ruby and Ruby on Rails running on the Windows platform.

Now go out and read Mike Hartl’s Ruby on Rails Tutorial for Rail 3 and create some applications.