Saturday, July 21, 2012

Using Fedora to teach Ruby on Rails

I've been tasked with giving a broad intro to Ruby on Rails talk to a group of co-workers in the coming weeks.

Although I could do this lecture style and have the class follow along as I work on a projector, I thought it would be more fun and interactive for everyone to actually touch a Rails install. I started planning ahead tonight with a Fedora 17 VM running in VirtualBox, but will recreate this setup in a Xen VM at work for the class to use. We have a training lab with 12 PC's in it, and I will allow each person to SSH into a F17 box using unique user accounts.

I will basically be following Chapters 1 and 2 from Michael Hartl's awesome Ruby on Rails Tutorial. I won't need to cover a lot of what is in Chapter 1, and by the end of the talk, we will have Chapter 2 completed. My goals for the talk is to provide:

A basic understanding of what Rails is

A basic understanding of MVC

What a Gem is

What a Gemfile is

How to start the (development) server

How to create a data model

How to use scaffolding

This is all pretty basic, but this is an overview, not a full-fledged Rails class. Most of the attendees will be seasoned developers, many familiar with ASP.NET MVC, so they should catch on quickly.

Now, for the setup.
I've always used RVM to manage my Ruby installations, but I decided this would be a good opportunity to get acquainted with the Ruby packages shipped with Fedora, so here is my setup process.

I've started by adding the following packages to a "Minimal" F17 install:

I have also added execjs and therubyracer gems to my Gemfile since nodejs is not in F17 by default.

Everything went awesomely. The Fedora Ruby packages worked great.

I created a user for each seat: one, two, three, and so on. Now, each user can start the rails server as so: rails s -p 3001 with each user having a different port, corresponding to the user/terminal they are at: 3001 for terminal one, 3002 for terminal two, 3003 for terminal three, and so on. Hopefully it will go well, and the attendees will have fun while learning.