CMPT 470, Fall 2012

Working with Rails

Databases

In general, it will be easier to use SQLite as your database for development (and switch to MySQL or PostgreSQL when you deploy). SQLite is much easier to work with for development: there is no server to install or connect to.

If you're for some reason determined to use MySQL for development, you may find my MySQL instructions helpful.

In CSIL

You should find everything you need for Rails development (version 2.3 at the moment, with SQLite as your database) installed on the CSIL Linux computers. There should be no need to install other packages.

If you'd like Rails 3, you should be able to install the Gems in your home directory. You'll need to install the rails and sqlite3-ruby Gems.

On Ubuntu

If you are working with Ubuntu, it's usually preferable to install the Ubuntu packages for the software you need (not manual installations, getting Git repository code, etc.). That way, the package manager will get all of the required libraries for you and everything will mostly just work.

At the moment, Rails 3 is not packaged in Ubuntu, so you'll want to install it as a Gem:

sudo apt-get install irb rake rubygems ruby-dev libsqlite3-dev sqlite3
sudo gem install rails sqlite3-ruby

To get to the commands that come with the gems, run this command or add it to your ~/.bashrc:

export PATH=/var/lib/gems/1.8/bin:$PATH

You'll have to add this line to your Gemfile for each project, so Rails finds the Javascript tools it needs:

gem 'therubyracer'

On Windows

The RubyInstaller will get you started, and you should be able to install the Rails gem once that is set up. For more info, see Installing Ruby on Rails on Windows.

On MacOS

Apple has provided instructions for Developing Rails Applications on OSX. (Only the first section of those instructions is relevant to creating the development environment.)


Copyright © , based on content created by Greg Baker.