Computers Mac

Riding the rails on Leopard

Mac OS X 10.5 comes with support for Ruby on Rails but the included releases were the stable releases at the time Leopard was frozen. Ruby hasn’t changed much but Rails has progressed quite a lot during that time. To make sure that your installation is up to date, do the following:

sudo gem update --system
sudo gem install rails
sudo gem update rake
sudo gem update sqlite3-ruby

This will (currently) bring your Rails version up to 2.0.2. Noteworthy changes to Rails 2.x include:

  • Sqlite3 is now the default database driver. MySQL is still available out of the box but sqlite3 makes it even quicker to set up a test project.
  • It is even more obvious that REST is preferred over SOAP for inter-machine communication under Rails.

For an extremely simple RoR solution, type this in the terminal:

$ rails TimeReport
$ cd TimeReport
$ script/generate scaffold project number:integer name:string
$ rake db:migrate
$ script/server

Then open your web browser and go to http://localhost:3000/projects. Congratulations, you have written your first Rails application.