Ruby On Rails - Technical Overview

Technical Overview

Like many web frameworks, Ruby on Rails uses the Model-View-Controller (MVC) architecture pattern to organize application programming.

In a default configuration, a model in a Ruby on Rails framework maps to a table in a database. By convention, a model named User will map to the database table users, and the model will have a filename user.rb within app/models. While developers can choose to use whatever model name and database table name they wish, this is not a common practice and it's usually discouraged because Rails philosophy is to use convention over configuration.

A controller is the component of Rails that responds to external requests from the web server to the application, and responds to the external request by determining which view file to render. The controller may also have to query the model directly for information and pass these on to the view. A controller may provide one or more actions. In Ruby on Rails, an action is typically a basic unit that describes a single rule on how to respond to a specific external web-browser request. Also note that, if a controller/action is not mapped to the Rails router, the controller/action will not be directly accessible by external web requests. Rails encourages developers to use RESTful routes, which include actions such as: create, new, edit, update, destroy, show, and index, as these are routed automatically by convention in the routes file if specified.

A view in the default configuration of Rails is an erb file. It is typically converted to output html at run-time, although, in theory, any format can be used as a view.

Ruby on Rails includes tools that make common development tasks easier "out of the box", such as scaffolding that can automatically construct some of the models and views needed for a basic website. Also included are WEBrick, a simple Ruby web server that is distributed with Ruby, and Rake, a build system, distributed as a gem. Together with Ruby on Rails, these tools provide a basic development environment.

Ruby on Rails relies on a web server to run. Mongrel was generally preferred over WEBrick at the time of writing, but it can also be run by Lighttpd, Apache, Cherokee, Hiawatha, nginx (either as a module - Passenger for example - or via CGI, FastCGI or mod_ruby), and many others. From 2008 onwards, the Passenger web server replaced Mongrel as the most-used web server for Ruby on Rails.

Ruby on Rails is also noteworthy for its extensive use of the JavaScript libraries Prototype and Script.aculo.us for Ajax. Ruby on Rails initially utilized lightweight SOAP for web services; this was later replaced by RESTful web services. Ruby on Rails 3.0 uses a technique called Unobtrusive JavaScript to separate the functionality (or logic) from the structure of the web page. jQuery is fully supported as a replacement for Prototype and, in Rails 3.1, is the default JavaScript library, reflecting an industry-wide move towards using jQuery. Additionally, CoffeeScript was introduced in Rails 3.1 as the default Javascript language.

Since version 2.0, Ruby on Rails offers both HTML and XML as standard output formats. The latter is the facility for RESTful web services.

Rails 3.1 introduced Sass as standard CSS templating.

By default, the server uses Embedded Ruby in the HTML views, with files having an html.erb extension. Rails supports swapping-in alternative templating languages, such as HAML and Mustache.

Ruby on Rails 3.0 has been designed to work with Ruby 1.8.7, Ruby 1.9.2, and JRuby 1.5.2+; earlier versions are not supported.

Rails 3.2 series is the last series to support Ruby 1.8.7.

Read more about this topic:  Ruby On Rails

Famous quotes containing the word technical:

    In middle life, the human back is spoiling for a technical knockout and will use the flimsiest excuse, even a sneeze, to fall apart.
    —E.B. (Elwyn Brooks)