Ruby on Rails Notes
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 —
- 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
- Unzip the Instant Rails 2.0 zip file into "C:\ror"
- Right-click on InstantRails-2.0-win.zip
- Select "Extract All..." (in Windows 7)
- Enter the directory "C:\ror"
- Wait, wait, wait. Extracting the zip file
took about 10 minutes on my Thinkpad T61.
Your mileage may vary.
Test the Ruby on Rails Installation (InstantRails on Windows)
- Start C:\ror\InstantRails.exe
- Windows may display a security warning saying that the
publisher could not be verified.
- If you continue, you will probably get a notification
from Instant Rails telling you that it has moved and asking
if you would like to regenerate the configuration files.
Click "OK" to re-generate files.
- Next, Windows will probably present a firewall security alert
about Apache.exe. We won't be using the Apache part of Instant Rails,
so you don't have to allow any access (i.e. you can choose "cancel").
- At this point, a window for Instant Rails should be displayed.
It will have an "I" in the upper-left corner and have traffic lights
for Apache and MySQL.
- Next, enable the cookbook test application by following the
- 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
- Windows will probably present another message about
Windows Firewall blocking some features. In our work with
Instant Rails, we will only need to access the Mongrel server
from the local machine (i.e. localhost), so you do NOT need
to allow Ruby to have the ability to communicate on networks.
You may wish to allow this for other purposes, but we aware
that there are some security issues involved in running any
server software on your computer.
- Try out the cookbook demo:
- 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.