Ruby and RoR Overview
Ruby is a dynamic, reflective, general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was initially developed and designed by Yukihiro “Matz” Matsumoto.
Ruby supports multiple programming paradigms, including functional, object oriented, imperative and reflection. It also has a dynamic type system and automatic memory management; it is therefore similar in varying respects to Python, Perl, Lisp, Dylan, and CLU.
In its current, official implementation, written in C, Ruby is a single-pass interpreted language. There is currently no specification of the Ruby language, so the original implementation is considered to be the de facto reference. As of 2008, there are a number of complete or upcoming alternative implementations of the Ruby language, including YARV, JRuby, Rubinius, IronRuby, and MacRuby, each of which takes a different approach, with JRuby and IronRuby providing just-in-time compilation functionality.
- Ruby code runs slower than many compiled languages (as is typical for interpreted languages) and other major scripting languages such as Python and Perl. However, in future releases (current revision: 1.9), Ruby will be bytecode compiled to be executed on YARV (Yet Another Ruby VM). Ruby’s current memory footprint for the same operations is higher than Perl’s and Python’s.
- Omission of parentheses around method arguments may lead to unexpected results if the methods take multiple parameters. The Ruby developers have stated that omission of parentheses on multi-parameter methods may be disallowed in future Ruby versions; the current (Nov 2007) Ruby interpreter throws a warning which encourages the writer not to omit
(), to avoid ambiguous meaning of code. Not using
()is still common practice, and can be especially nice to use Ruby as a human readable domain-specific programming language itself, along with the method called
A list of “gotchas” may be found in Hal Fulton’s book The Ruby Way, 2nd ed (ISBN 0-672-32884-4), Section 1.5. A similar list in the 1st edition pertained to an older version of Ruby (version 1.6), some problems of which have been fixed in the meantime.
retry, for example, now works with
for, as well as iterators.
Ruby on Rails
Ruby on Rails is a free web application framework designed to make web development faster, simpler and more efficient. Often shortened to Rails, or RoR, Ruby on Rails is written in the Ruby programming language.
Like many contemporary web frameworks, Rails uses the Model-View-Controller (MVC) architecture for organizing application programming.
Rails provides ‘out of the box’ scaffolding which can quickly construct most of the models and views needed for a basic website. Other helpful development tools come with or are installed with Rails, such as the WEBrick web server, and the Rake build system.
For web services Rails initially supported lightweight SOAP; later it was replaced by RESTful web services. The recommended REST-based programming structure changed drastically in version 1.2.
Installing and Configuring Rails
In the original version of this tutorial, Curt showed how to install and configure Rails on a Microsoft Windows platform. In preparation for this update, we discussed how to handle the topic this time. We could do the same thing again, but there’ve been some complaints about favoring one environment (especially Windows!) over others. Alternately, we could show you how to install and configure Rails on all of them–Windows, Mac, and Linux–but that would take up a bunch of space. Alternately, we could take advantage of the fact that, since the original tutorial, new tools have emerged for each of these environments that make installation and configuration a snap. We could just point you to those resources. Because this last option both gets us off the favoritism hook and requires less effort… well, we’re just doing “the simplest thing that could possibly work.”
For Windows, use Instant Rails.
For Mac OS X, use Locomotive.
For Linux, try the Rails LiveCD.
Same Ruby on Rails Demos Exampls Code Samples
- Rolling with Ruby on Rails – Curtis Hibbs of ONLamp.com offers his first excellent introduction to Ruby on Rails. This is the article that got me really excited about RoR.
- Rolling with Ruby on Rails, Part 2 – The sequel to Curtis Hibbs excellent series of articles.
- Four Days on Rails (PDF) – a great tutorial that is broken down into simple tasks that you can do over a four day period. To be quite honest, this tutorial only takes about 2 hours, but nonetheless it is very well organized!
- Really Getting Started in Rails – Amy Hoy has a great tutorial that not only covers RoR, but also introduces the reader to many of the basic concepts of the very cool Ruby scripting language.
- Tutorial in Ruby on Rails – is a basic tutorial aimed at newbies.
- Fast-track your Web apps with Ruby on Rails – IBM jumps into the sandbox with an excellent (as usual) tutorial to get you on your feet fast.
- Getting Your Feet Wet With Ruby on Rails – Talking about getting on your feet fast, this one from Webmonkey promises to get them wet too!
- How to make a todo list program with Rails – Another excellent introductory tutorial that actually helps you build something useful!
- Ajax on Rails – Curtis Hibbs offers part 3 of his look at RoR
- Many to Many Tutorial for Rails (PDF) – is a nice document that begins to delve into some of the more complex parts of web application programming, but in fine Ruby on Rails manner, it’s really not too complicated!
- Distributing Rails Applications – A Tutorial – So now you’ve built your RoR application, how to you push it to a production server? This tutorial covers the bases.
- Installing Ruby on Rails with Lighttpd and MySQL on Fedora Core 4 – and of course this list wouldn’t be complete without a shameless bit of self-promotion, this tutorial promises what it says. Other install tutorials can be found here, here and here!