In-Class Exercise #8
Ruby on Rails
Here are links to the slides I presented in class:
Installing Instant Rails 2.0 on Windows
- Download Instant Rails 2.0 —
- Note that the Instant Rails zip file often will not unzip
correctly using WinZip or the built-in Windows unzip utility.
You may need to use another program such as 7-zip to get it to
- Disclaimer: I don't know of any problems from installing
Instant Rails, but as with all software, you should back
up your system and run a virus scan on the downloaded file
- Use 7-zip to unzip the Instant Rails 2.0 zip file into "C:\ruby"
- Right-click on InstantRails-2.0-win.zip
- Select 7-zip --> Extract Files...
- Enter the directory "C:\ruby"
Test the Ruby on Rails Installation (InstantRails on Windows)
- Start C:\ruby\InstantRails.exe
- Click "OK" when prompted to re-generate files
- You may have to allow some Windows firewall settings for apache
- Enable the cookbook test application
- Click the "I" button in the top-left of the Instant Rails window
- Select "Rails Applications" --> "Manage Rails Applications"
- Check the box next to the cookbook application
- Click "Start with Mongrel"
- A console window should appear with some start up messages
- You may have to allow another Windows firewall for Mongrel
- Try it out
- Open a web browser and point it to: http://localhost:3001
- Stop the application by pressing control-c in the console window
Getting started with the tutorial:
- cd c:\ruby
- rails exchange
- cd exchange
- rake db:create:all
- continue with the tutorial...
NOTE: This tutorial is written for the 1.x versions of RoR.
I've noted some changes below that you will need to make in order
for the tutorial to work.
- rails cookbook2
- cd cookbook2
- rake db:create:all
- def index render :text => "Hello world" end
- For the "Creating the Cookbook Database" section do this instead:
- ruby script\generate scaffold Recipe title:string instructions:string
- rake db:migrate
- URL for recipes will be: http://localhost:3000/recipes
- Other changes will be needed...
as part of this exercise, see if you can determine where/how.