. View this ad or post your own Ruby Job!

Friday, November 11, 2005

Ruby on Rails

What have I found out so far?
  • Definition of Ruby
  • Ruby Windows Installer
  • Interactive Ruby - Open a new DOS window and type irb --simple-prompt A prompt appears as >>
  • Run a Ruby program by typing ruby hello.rb
  • Learnt some features of Ruby like comments, naming rules, variables, constants, strings etc.
  • Various Text Editors/IDEs like SciTE, NotePad2
  • Constructs like the if else and while
  • Some methods in Ruby.
  • Arrays
  • Writing one's own methods
  • Writing one's own class
Armed with the elementary knowledge of Ruby gained so far, I am now going to explore Ruby on Rails. Rails is a full-stack, open-source web framework (support structure) in Ruby, that closely follows the Model View Controller (MVC) architecture for writing real-world applications with less code and no cumbersome XML configuration files. Simply put, Rails is an open source Ruby framework for developing database-backed web applications.

To start using Ruby on Rails, I decided to use Instant Rails a one-stop Rails runtime solution containing Ruby, Rails, Apache, and MySQL, all preconfigured and ready to run. No installer, you simply drop it into the directory of your choice and run it. It does not modify your system environment. Instant Rails is completely self-contained in its own directory tree and should not interfere with any existing Ruby or Rails installation. Anything you run within IR will use its private copy of Ruby and Rail. I now downloaded and installed Instant Rails on my Windows XP Pro system. It has created a folder C:\InstantRails on my system. You need to follow the instructions for setting up Instant Rails properly.

I am now going to create a simple Ruby on Rails application called jauth. The steps are:
  • Go to folder C:\InstantRails and double-click on file InstantRails.exe
  • On your System Tray you will see an I. Right click on this, and then click on Rails Applications/Manage Rails Applications...
  • A window pops-up. Now click on Create New Rails App (open console window) A DOS window open and you are in the folder C:\InstantRails\rails_apps
  • Next, type rails jauth
  • Keep this DOS window open
Rails is both a runtime web app framework and a set of helper scripts that automate many of the things you do when developing a web application. With the last command, we have created a jauth subdirectory containing a complete directory tree of folders and files for an empty Rails application.

A Rails web application can run under virtually any web server, but the most convenient way to develop a Rails web application is to use the built-in WEBrick web server. Let's start this web server and then browse to our jauth application. To do this
  • Right click on I in your system tray
  • Now click on Rails Applications/Manage Rails Applications...
  • Select jauth and click on the button Start with WEBrick. This open a DOS window.
Now open your browser and browse to You should see a page that says - Congratulations, you've put Ruby on Rails!

In my next post, I shall start building my jauth application.

First Post | Previous | Next

Technorati Tags: ,
Blogs linking to this article


Post a Comment

Links to this post:

Create a Link

<< Home

Valid XHTML 1.0!