Friday 8 May 2009

WK1: What is "Ruby on Rails"?

First of all, we need to have an overview on "Ruby on Rails".




  • Ruby is a cross-platform interpreted language which has many features in common with other ‘scripting’ languages such as Perl and Python. However, its version of object orientation is more thorough than those languages and, in many respects, it has more in common with the great-granddaddy of ‘pure’ OOP languages, Smalltalk. The Ruby language was created by Yukihiro Matsumoto (commonly known as ‘Matz’) and it was first released in 1995.




  • Rails (often called simply “Rails”) is a framework for building web applications with Ruby.




    • Honestly, it was not easy to get it to work properly. Basically, it is just a development tool and therefore, I need another two components for the MVC project which are the web server and the database. I chose Apache and MySQL as the other two components. I have some exprience with the MVC development approach. The tools I am familiar with are SQL Server, IIS, ASP, VB script and Javascript. I have ever used these tools for the MVC project.

      I have taken hours to install Ruby and MySQL on my Vista machine. I just think my Vista machine is not very stable and also, I am not sure whether I have installed the right version of Ruby and MySQL on it. With such uncertinty in mind, I decided to take a step back and download the comparatively mature version of Apache, MySQL, PHP and Ruby and installed on my another machine on which Windows XP are running. Finally I take a short cut by installing Instant Rails. However, I can't believe I have been struggling for a couple days with the setup of "Ruby on Rails".

      In the first place, I really wanted to take a shortcut by installing "Instant Rails" on XP machine. However, I couldn't get it tp work very well. The problem is I have actually installed MySQL 5, Apache 2 and PHP 5 on my machince and then, I still put on "Instant Rails". Basically, two different versions of the mentioned software are running on my machines. I have been working very hard to resolve the conflicts among them. Then, I switch to my Vista machine and try to install "Instant Rails" again. Before I do this, I need to uninstall MySQL & Ruby from this machine first. I couldn't believe I could still get a strange error. This time the PHP library couldn't be loaded. Eventually, I could manage it to function as expected after a few tries. The following Youtube video clip is an excellent demonstration on installing "Instant Rails" on Vista. Great ! I can move on.

      http://www.youtube.com/watch?v=xbKV1sndLGo&eurl=http%3A%2F%2Fbroadcast%2Eoreilly%2Ecom%2F2008%2F12%2Finstalling%2Dinstant%2Drails%2Don%2Dwi%2Ehtml&feature=player_embedded

      I summerise the steps as follows:

      1.Unzip InstantRails-2.0-win.zip
      2.Click OK to locate config files
      3.Manage Rails Applications
      4.Creata New Rails App...
      5.Create a New Rails Application by typing "rails hello" at command line
      6.Start with Mongrel
      7.Test the host with IE by typing "http://127.0.0.1:3000/"
      8.Diplay "Welcome aboard" web page



      9.Open Ruby Console Window to generate code
      10.Go to application directory (e.g...rails_apps\hello>ruby script/generate controller hello index)
      11.Open Windows EXplorer to view the files of hello
      12.test "hello" with IE by typing "http://127.0.0.1:3000/hello"

      Great! This is the first web application I created by Ruby on Rails

      References

      Collingbourne, H. 2008, The Little Book Of Ruby, 2nd edn, Sapphiresteel Software, Dark Neon Ltd., also available as pdf file, viewed 9 MArch 2009,

      No comments: