Rails makes use of the MVC (Model/View/Controller) software architecture pattern in organizing software development. MVC represents an attempt to separate a program into components whose functionality is similar in many applications. This makes it possible to re-use components, replace or modify components without impacting other components, and abstract the common functionality and form templates that speed up development of new applications.
The MVC design pattern is based on the observation that many application programs have a "model" component, which represents the collection of information that the application is dealing with, a "view" component, which represents the user interface, and a "controller" component, which implements the functions that retrieve or update the specific information requested by the user.
In simple applications, as in Rails' default configurations, the model is implemented as database tables. Such database tables represent a persistent storage of the information or data being modeled. Data modeling refers to the process of developing and implementing data structures that reflect the logical relationships between the data as best as possible. Rails encourages a naming convention that enables automatic implementation of models. For example, a model named Customer maps to a database table customer using a file customer.rb under the app/models directory.
In the case of Rails, the controller typically takes a user request as input and performs some action that generates and displays the information requested. Such requests are usually initiated through a web browser. In the simplest case, the controller determines which "view file" should be displayed. In Rails an action can be linked to an http request using the Rails router, which maps the request to an action/rule, properly passing the parameters to the corresponding procedure. If this mapping is implemented, external web requests will be directly routed to specified actions.
Ruby includes a special syntax and programming language, similar to PHP and JSP, that is designed for convenient dynamic generation of text documents, such as web pages. Such text documents are specified by writing templates in erb files, where erb stands for embedded Ruby. An erb template is basically a text file that may contain any number of embedded Ruby instructions, which are identified by special markers. These instructions can be used to insert any kind of dynamic content from databases or other sources.
The two most used tags are
<%= exression %>
<% scriptlet %>
Dear <%= @customer %>
Dear Jane Doe
The tag without the equal sign is used to mark so-called scriptlets, which are used to implement loops and conditionals. The following example generates a list in html format:
<% for @title1 in @title_list %>
<li><%= @title1 %></li>
<% end %>
For more information see the official Ruby on Rails web site.