Dark Moon Velvet

Posts Tagged ‘rails

Requirements

First, you need ruby!

Open your command-line, first thing to do is update gems. On unix systems you can prefix the following with sudo if you do not have the permissions.

gem update --system

Then install rails type in:

gem install rails --include-dependencies

Creating a RoR project

Done? Create a folder somewhere, in the rest of the post I’m going to use D:/Test/2009-04/. To create a rails project you simply need to type rails followed by the name of the project, for example to create a project darkmoon configured for a mysql database:

cd d:\Test\2009-04\
rails -d mysql darkmoon

To test some basic functionality, run the WEBrick server:

cd darkmoon/
ruby script/server

On a unix box the last line should read ./script/server/

Go to http://localhost:3000/, if you see the rails welcome page all is well.

Database

Your database configuration is located in config/database.yml. Default values are usually what you need if you do not run some exhotic configuration.

You should make sure your database driver is available, if you are not you will need to instal them, for example:

cd d:\Test\2009-04\darkmoon\
gem install mysql

Your database configuration file is located in config/database.yml. Often for testing, the dafaults should do nicely.

To setup the database:

cd d:\Test\2009-04\darkmoon\
rake db:create:all
Tags: , ,