Using Rails in Leopard

Here are some notes from SI539 – when you upgrade to Leopard – pretty much you no longer need Locomotive as it has plenty of Ruby and Rails built-in.
$ rails –version
Rails 1.2.3
$ ruby –version
ruby 1.8.6 (2007-06-07 patchlevel 36) [universal-darwin9.0]
Here are some notes as to how to use it instead of Locomotive – actually now DOS and Mac are even more similar.

There is good news and bad news about the upgrade to Leopard – ignore this if you run Mac OS 10.4 or Windows.
– The bad news is the Locomotive breaks
– The good news is that Locomotive was a pain in the backside and that Leopard has a very recent version and Ruby *and* Rails out of the box!!!!!
So you never have to use Locomotive again – yayayay – and I never have to make a Macintosh install for this class ever again – because it is already installed on macs!!!! YAYAYAYAYA
So here is your really translation from Locomotive to command line. Form now on the stuff you do on a Mac will be like what we do in Windows. I assume that you keep the rails_apps directory in Documents. Open a terminal window under Applications -> Utilities -> Terminal
Go into the rails_apps driectory
cd ~/Documents/rails_apps
The ls command should list the contents of the directory – it should have directories like assn7, midterm, each – one for each rails directory.
To start the rails Server (like pressing the green button in Locomotive)
cd assn7 (whichever directory)
ruby script/server
Point your browser to http://localhost:3000/ – viola! The terminal window also shows you the log – so there is no need for an extra “tail window” – double prizes!
To stop the server press CTRL-C in the server window – this terminates the server and gets you back to the command prompt.
To make a new application called “assn9” do the following:
cd ~/Documents/rails_apps
rails assn9 -d sqlite3
It will set up the database as SQLlite3 automatically – no more cutting and pasting the database.yml files! Yay!
Then to add a controller – it is the same as ever
cd assn9
ruby script/generate controller portal index
ruby script/generate model Story
And to start it up jsut do
ruby script/server
Pressing control-C when done or when you want to restart your server – like if you changed a vendor module.