Ruby on Rails is an open source framework for web applications written in Ruby. It has become very popular recently because it allows you to write web applications much faster than with most other frameworks. You have to write very little code to do the most common operations and its clean MVC architecture ensures that your application is clearly structured. Ruby on Rails comes with several generator scripts that automatically created the required files.
So far, I created all my dynamic web sites using PHP. Writing a simple application such as a guest book requires quite a lot of code in PHP to connect to the database, retrieve the entries, add new entries and so on. With Ruby on Rails that’s much easier. You simple create a table, run a generator script to create a model and a controller. A cool feature called scaffolding automatically creates an interface to list, add, edit and remove entries. This is very useful to add some entries to a new table before you have created the real interface. But even that is really simple.
For example, by adding a line like “@entries = Entry.find_all” to a controller action, Ruby on Rails fetches all rows of the entries table (that’s another cool feature: table names are lowercase and plural, model names uppercase and singular – Ruby on Rails can convert them automatically) and saves them in a variable called entries. In a template with the same name as the action, you can loop trough all entries using “<% @entries.each do |entry| %>” (Ruby code is embedded in <% %>-Blocks inside the HTML template) and then print them easily using “<%= entry.message %>” etc.
Ruby on Rails is really cool. In order to understand Rails, I decided to learn Ruby first. So far, I can recommend two links for learning Ruby. The first one is the Ruby user’s guide by matz, the creator of the language, which provides a rather short introduction to Ruby. The other one is Why’s (Poignant) Guide to Ruby, which is quite entertaining.
O’Reilly has a tutorial for Ruby on Rails: Rolling with Ruby on Rails (this includes installation instructions for Ruby, Ruby on Rails and MySQL) and Rolling with Ruby on Rails, Part 2. More tutorials and API references can be found on the Ruby on Rails Homepage.