Search  
   
Browse by Category
 
Netfirms 24/7 Support .: SCRIPTS & APPLICATIONS .: Ruby on Rails Quickstart Guide

Ruby on Rails Quickstart Guide

Use this as a quickstart guide to getting Ruby on Rails up and running with your Netfirms Advantage or Business hosting account. In this demo you will create a simple Ruby on Rails application.

I. Enable SSH on your Netfirms Account
  1. Login to the Netfirms Control Panel at https://controlpanel.netfirms.com
  2. Click Site Tools
  3. Click SSH
  4. Click Enable to enable SSH
II. Create a MySQL Database for Ruby on Rails:
  1. Login to the Netfirms Control Panel at https://controlpanel.netfirms.com
  2. Click Site Tools
  3. Click Databases
  4. Click Add
  5. You will then be prompted for a Database Description

    The following will be created by the system for your database:

    Database Name
    Database address or hostname will be "MYSQLHOST"
    User Name
    Password

III. SSH into your account using an SSH Client

Putty/OpenSSH or most any other widely free clients (for Windows users) or the default Terminal (for Mac / Linux users) may be used to access your Netfirms account via SSH.

Please configure your SSH client with the following information (you may want to refer to your Netfirms Welcome Letter to recall your username and password):

hostname: <ssh.netfirms.com>

username: <membername>

password: <password>

IV. Install Ruby on Rails
  1. Once logged into your account via SSH, you will be placed into the /www folder by default. to install all Ruby on Rails components and library, enter the following command: rails railsapp
  2. Change to the railsapp directory by entering the following command: cd railsapp
V. Configure Ruby on Rails Files
  1. Execute the following command: cd config
  2. Using vi editor OR ee, edit database.yml to specify the db, user and password
VI. Configure Domain Forwarding
  1. While logged into the Netfirms Control Panel, click Domains
  2. For your domain, click Admin to configure domain forwarding to point to "/railsapp/nfrubyrails/" (this step cleans up the URL)
VII. Configure the Ruby on Rails MySQL Database: The steps below will assist you to set up a sample table in your Ruby on Rails database
  1. While logged into the Netfirms Control Panel, click Site Tools
  2. Click Databases
  3. For the Ruby on Rails database, you created in step #II, click Admin
  4. Click phpMyAdmin
  5. From the left frame, under the Home section, click the database id (eg. d60234532)
  6. Setup a table in MySQL, such as:
    create table employees (
    id integer not null auto_increment primary key,
    name varchar( 64 ) not null
    );
VIII. Configure Ruby on Rails Files: The steps below will assist you to configure a sample ruby file based on the sample table created in VII
  1. SSH to your account
  2. Type the following command: ruby script/generate model Employee
  3. Type the following command: ruby script/generate controller Employee
  4. Using vi editor OR ee, edit railsapp/app/controllers/employee_controller.rb by inserting the following line inside the class declaration: scaffold :employee
You should now have a simple database-driven, Ruby on Rails powered website up and running at the following URLs:
http://www.yourdomain.com (where yourdomain.com is your registered domain hosted by Netfirms)
http://www.yourdomain.com/employee

For further support and assistance on Ruby on Rails, we suggest reviewing the following Ruby On Rails support sites: http://wiki.rubyonrails.org/, as well as at http://rubyonrails.org/docs.

How helpful was this article to you?


.: Powered by Lore 1.5.6
Visit Netfirms.com Web Hosting | Copyright © 1998 - 2006 Netfirms, Inc. All Rights Reserved.