| Recent Blinked Bits by 1996 |
|
Ruby on Rails Wikipedia RSS Feed
shared by wikipedia into ruby on rails Bio 2 years ago
Topic blinked on Apr 13, 2006 10:51 pm
Ruby on Rails, often called RoR or just Rails, is an open source web application framework written in Ruby that closely follows the Model-View-Controller (MVC) architecture. It strives for simplicity and 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" 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 definitions need not specify the column names; Ruby already can find them from the database itself, so defining them in both the program and the RDBMS 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, a project-management tool, by David Heinemeier Hansson. It was first released to the public in July 2004. Version 1.0 was released December 13, 2005.
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 the ActiveRecord::Base 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.
Views are done as a fragment of HTML (.rhtml files) with Embedded Ruby interspersed or programmatically used in pure Ruby through Builder. 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 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 through the web browser.
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, typically in form of /example_controller/method, which calls ExampleController#method, and presents the data using the view file /app/views/example_controller/method.rhtml, unless the method redirects elsewhere.
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 support.
Ajax on Rails
A separate technology called Ajax, which allows for using JavaScript and XML to process queries by a web browser to a webserver as background processing 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 or FastCGI support will work. On Apache, mod_ruby 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 - though, if needed, using direct SQL queries is possible. Rails attempts to maintain database-neutrality, application portability over different database systems, and usability of pre-existing databases for Rails application development as much as possible, though due to different feature sets of the RDBMSes, it is not completely guaranteed by the framework alone. Several different RDBMS systems are supported, including MySQL, PostgreSQL, SQLite, IBM DB2, Oracle and Microsoft SQL Server.
Requirements
* Web server such as Apache 1.3.x or 2.x, lighttpd, or any FastCGI-capable webserver with a mod_rewrite-like module. For development, Rails' "server" script uses WEBrick, which may be used in place of other web servers. However, WEBrick generally exhibits slow performance and is not recommended for production use.
* FastCGI for production performance. CGI is possible but quite slow. Rails supports Apache's mod_ruby, though its use is severely discouraged for several reasons.
* Database and driver (e.g. MySQL, PostgreSQL, or SQLite)
*Ruby On Rails Project Homepage
*Rails Wiki
*try ruby! (in your browser)
*Instant Rails - a Windows installer for Ruby, Rails, Apache, and MySQL
*Rolling with Ruby on Rails - Part I
*Rolling with Ruby on Rails - Part II
*Ajax on Rails in Onlamp.com
*Fast-track your Web apps with Ruby on Rails (David Mertz article at IBM developerWorks)
*How to make a todo list program with RoR
*What every webmaster MUST know about Ruby on Rails and AJAX
*Javascript Meets Ruby Kiko and their Javascript port of ActiveRecord
*RailsRoad A real newbie attempts to climb the Rails to find Nirvana
*Ruby on Rails Forum News and discussion forum.
Category:Web application frameworks
de:Ruby on Rails
fr:Ruby on Rails
pt:Ruby on Rails
fi:Ruby on Rails
zh:Ruby on Rails
The Wikipedia article is licensed under http://www.gnu.org/copyleft/fdl.html and uses material from http://en.wikipedia.org/wiki/Ruby_On_Rails. A preview of this article is available at http://www.blinkbits.com/en_wikifeeds/Ruby_On_Rails.... Read more...
Comments (0) | discover more Bio | share more Bio
 
|
|
| About 1996 |
Blinker |
Joined: Mar 07 2005 Location: Website:
Private Message:
Total Bits: 171 Bits per day: 0.15 Bits per day Bits %: 0.00% of total
|
|