Printer Friendly
The Free Library
14,694,313 articles and books
Member login
User name  
Password 
 
Join us Forgot password?

Ruby on rails.


Ruby on Rails See Ruby. , often called RoR or just Rails, is pen source web application framework written in by that closely follows the Model-ViewController (MVC (Model View Controller) An architecture for building applications that separate the data (model) from the user interface (view) and the processing (controller). ) architecture. It strives for simplicity allowing real-world applications to be developed in less code than other frameworks and with a minimum of configuration. Rails is primarily distributed through RubyGems, which is the official packaging format and distribution channel for Ruby libraries and applications.

Philosophy

Rails' guiding principles include "Don't Repeat Yourself Don't Repeat Yourself (DRY, also known as Once and Only Once or Single Point of Truth (SPOT)) is a process philosophy aimed at reducing duplication, particularly in computing. " and "Convention Over Configuration". "Don't Repeat Yourself' means that definitions should only have to be made once. Since Rails is a "full-stack" framework, the components are integrated so that bridges between them need not be set up manually. For example, 'in Active Record, class definition needs not specify the column names; Ruby already can find them from database itself, so defining them in both the program and the RDBMS (Relational DataBase Management System) See relational database and DBMS.

RDBMS - relational database
 would be redundant.

"Convention Over Configuration" means that the programmer only needs to specifically configure what is unconventional. For example, if there is a Post class in model, the corresponding table in database is Posts, but if the table is unconventional (e.g. blogposts), it must be specified manually (set-table-name "blogposts").

History

Ruby on Rails was extracted from Basecamp (http://www.basecamphq.com/), a project-management tool, by David Heinemcier Hansson. It was first released to the public in July 2004.

Rails' MVC architecture

The pieces of the Model-View-Controller (MVC) architecture in Ruby on Rails are as follows:

Model

In object-oriented, database-driven MVC web applications, Model consists of the classes representing RDBMS tables.

In RoR, Model classes are handled through the Active Record. Usually, all the programmer needs to do is to subclass In programming, to add custom processing to an existing function or subroutine by hooking into the routine at a predefined point and adding additional lines of code.

subclass - derived class
 the ActiveRecord class, and the program will automatically figure out which RDBMS table to use and what columns the table has. Relationships between tables are specified with simple commands.

View

In MVC, View is the display logic, or how the data from the Controller classes is displayed. In web applications, this frequently consists of a minimal amount of code, interspersed in HTML HTML
 in full HyperText Markup Language

Markup language derived from SGML that is used to prepare hypertext documents. Relatively easy for nonprogrammers to master, HTML is the language used for documents on the World Wide Web.
.

Views are done as a fragment of HTML (.rhtml files) with Embedded Ruby interspersed or programmatically Using programming to accomplish a task.  used in pure Ruby through Builder (http://builder.rubyforge.org/). The actual code is part of Rails' Action Pack, but programmers rarely need to touch it outside of Embedded Ruby.

For each method in the controller that needs to display user output, a small HTML code fragment needs to be written. The page layout :For the Wikipedia policy about articles layout, see Wikipedia:Guide to layout. Page layout is the part of graphic design that deals in the arrangement and style treatment of elements (content) on a page.  is described separately from the controller action that displays layouts, and the fragments can also call other fragments.

Controller

In MVC, Controller classes respond to user interaction and call the application logic, which in turn manipulates the data in Model and displays the data through View. In web-based MVC applications, the Controller methods are initiated by the user though the web browser The program that serves as your front end to the Web on the Internet. In order to view a site, you type its address (URL) into the browser's Location field; for example, www.computerlanguage.com, and the home page of that site is downloaded to you. . Controller implementation is handled through Rails' Action Pack, which has class

Applicationcontroller. Rails applications simply subclass Applicationcontroller and write required actions as methods, which can then be accessed through the web. Rails also provides out-of-the-box scaffolding, which can quickly construct most of the logic and views needed to do common operations, such as CRUD.

Other modules

In addition to this, Rails also offers some other modules, like Action Mailer for sending email and Action Web Service for SOAP and XML-RPC (XML Remote Procedure Call) A message-based protocol based on XML for accessing services over the Internet. An XML-RPC message is passed to the target server in an HTTP POST request. For more information, visit www.xml-rpc.com. See XMLP, XML and RPC.  support.

Ajax on Rails

A separate technology called Ajax, which allows for using JavaScript and XML XML
 in full Extensible Markup Language.

Markup language developed to be a simplified and more structural version of SGML. It incorporates features of HTML (e.g., hypertext linking), but is designed to overcome some of HTML's limitations.
 to process queries by a web browser to a webserver as background processing Processing in which the program is not visibly interacting with the user. Earlier personal computers used operating systems that ran background tasks only when foreground tasks were idle, such as between keystrokes.  without loading additional webpages, has been combined with this technology to produce a system referred to as "Ajax on Rails". Rails provides several helpers that make implementing Ajax applications easier.

Web server support

For development and testing, the lightweight WEBrick web server included with Ruby is often used as the application server. For production use, Apache or Lighttpd with FastCGI is recommended, but any web server with CGI CGI
 in full Common Gateway Interface.

Specification by which a Web server passes data between itself and an application program. Typically, a Web user will make a request of the Web server, which in turn passes the request to a CGI application program.
 or FastCGI support will work. On Apache, mod_ruby (http://www.modruby.net/en/index.rbx/mod_ruby/whatis.html) can help with performance considerably.

Database support

Since the Rails architecture strongly favors database use, an RDBMS system is recommended for data storage, but Rails also supports the SQLite library if running an RDBMS server is not possible. The database access is entirely abstracted from programmer's point of view, and Rails handles access to all databases automatically.

Rails is also fairly neutral when it comes to the database schema--a Rails application can be developed atop an already existing database. Several different RDBMS systems are supported, including MySQL, PostgreSQL, SQLite, DB2, Oracle and SQL Server An earlier relational DBMS from Sybase and from Microsoft. Sybase introduced SQL Server in 1988 for various Unix versions. In that same year, with help from IBM, Sybase created an OS/2 version that Microsoft licensed and branded as Microsoft SQL Server. . Requirements

* Apache 1.3.x or 2.x (or any FastCGI-capable webserver with a mod- rewrite-like module)

* FastCGI (or mod_yuby) for production performance (CGI is used for development)

* Database and driver (e.g. MySQL, PostgreSQL, or SQLite)
COPYRIGHT 2005 A.P. Publications Ltd.
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 2005, Gale Group. All rights reserved. Gale Group is a Thomson Corporation Company.

 Reader Opinion

Title:

Comment:



 

Article Details
Printer friendly Cite/link Email Feedback
Title Annotation:DEFINITIONS
Publication:Database and Network Journal
Date:Dec 1, 2005
Words:799
Previous Article:Moodle.(DEFINITIONS)
Next Article:What you should know about R on R and AJAX.(DEFINITIONS)



Related Articles
PERCUSSION SOFTWARE, RUBY DIGITAL PROVIDE CONTENT MANAGEMENT SOLUTION TO ONLINE FINANCIAL ADVISOR.
Restaurants ready for growth.(Construction & Design)(Brief Article)
OLDER 'BOARDERS BACK IN SPORT VETERANS HELP NEWBIES AT VERDUGO SKATE PARK SCENE.(News)
O'Reilly.(Photoshop Workflow Setups)(Python in a Nutshell: A Desktop Quick Reference)(Ruby Cookbook. Recipes for Object-Oriented Scripting)(Book...
O'Reilly.
Ajax on Rails.
Ajax on Rails.
What you should know about R on R and AJAX.(DEFINITIONS)
Rails Cookbook.
Rails Cookbook.

Terms of use | Copyright © 2009 Farlex, Inc. | Feedback | For webmasters | Submit articles