Rails 3/Ruby on Rails framework

From Wikibooks, open books for an open world
< Rails 3
Jump to: navigation, search

What's a web framework?[edit]

For ages people have programmed the web with Perl and PHP. These languages did not have a definite pattern. People could do any thing with them: put code in middle of web pages, connect to database from anywhere, put images into any folder or insert them into web pages, and so on. All this created a messy, lengthy code which, when written by one programmer was quiet unreadable by another. Even the programmer who wrote such code might not be able to decipher after returning to it after some months.

People began to experiment with standard libraries of code, standard patterns of making web applications. For example, why not store all images in an img folder, why not store all Javascript in a js folder and Stylesheets in a css folder and so forth. The unordered army of web programmers was becoming standardized.

Many open source projects emerged. They all promised and mostly delivered a good web development experience. For example Python language got Django and Turbogears. PHP got Symfony, Codeigniter and PHP on Tracks. Ruby got Merb, and of course, Rails.

Out of these frameworks, Ruby on Rails, or Rails for short, has shot into popularity. Why so? Read the book and you will know.

Rails web framework[edit]

Convention over configuration[edit]

Don't repeat yourself (DRY)[edit]

MVC architecture[edit]