SunQuest
 
       Ruby-on-Rails
  Home arrow Ruby-on-Rails arrow Understanding Action Views in Ruby-on-Rail...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
RUBY-ON-RAILS

Understanding Action Views in Ruby-on-Rails
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 7
    2006-08-15

    Table of Contents:
  • Understanding Action Views in Ruby-on-Rails
  • ActionView: Templates and Formatting Helpers
  • ActionView: Pagination and Layouts
  • Rails in the Real World

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Understanding Action Views in Ruby-on-Rails


    (Page 1 of 4 )

    Continuing our discussion of Ruby-on-Rails, this article covers the basic services provided by the ActionView. The ActionView helps you present data to your users. Keep reading to learn some terminology and study an example application.

    In MVC based architecture, it is the responsibility of the View component to present the data to the user in a way that is "palatable" to the user, abstracting out the unnecessary details. In other words, any framework implementing and supporting the MVC pattern should provide for the easier methods of abstraction and presentation of the required data. RoR is also a framework implementing the MVC pattern. It provides the View component as a part of ActionPack. The functionalities of the View component are encapsulated within the ActionView package.

    In this discussion, I will be focusing on the basic services provided by ActionView. In the first section the focus will be on the common terminology associated with  the View component. In the second and third sections, I will discuss the ActionView of RoR. And in the last section, the theory of the second and third sections will be put into practice as an application. So without much ado, let's get started.

    View Component Terminology

    The View component is all about presenting the data to the user. Hence the terminology associated with the View component deals more with how to present than what to present. The idea of "what to present" provides formatting and design guidelines. The main terms used in the context of View are:

    1. Template
    2. Layout
    3. Pagination

    There are other terms used in the context of View but the above three are the most commonly used.

    1. Template:

      By definition, a template is “A document or a file having a preset format, used as a starting point for a particular application so that format does not have to be recreated each time it is used.” That means a template contains formatting information that is often required, such as layout and place holders for the dynamic or context specific data. The best example of a template is a letter template provided by any word processing application. In the context of a web application, any of the free login/email templates in HTML format is an example of a template.

    2. Layout:

      In terms of software (web or desktop), layout means an "arrangement of GUI elements,” which means layout controls how the GUI elements (such as buttons, textboxes, and so forth) are placed within a template and in relation to each other. For example, in a registration form, the layout can be horizontal, that is the widgets (GUI elements) are placed horizontally; vertical; or both.

    3. Pagination:

      Pagination is the process of decomposing a large table into a number of smaller "pages." This comes in handy when the data to be presented in the table format is huge. The origin of pagination was in print media. However, the term found a place in web development when the requirement for decomposing the data came up. Though pagination is a neat way to present a large amount of data in a orderly manner, along with it comes problems associated with navigation, links, and so forth.

    Apart from the above mentioned terms, there are others such as forms, resource links, and so on that are associated with the View component. However, the above three are more conceptually inclined than the ones mentioned later. The next question is, how are these associated with ActionView? And that is the focus of the next two sections.

    More Ruby-on-Rails Articles
    More By A.P.Rajshekhar


       · Presenting the data to the user in a palatable way is one of the major functionality...
     

    RUBY-ON-RAILS ARTICLES

    - Ruby On Rails: Making Your First Dynamic Site
    - Ruby on Rails: Beginning Rails
    - Ruby: Modules, Mixins, Fixins, and Rails
    - Controlling Information Access with the Rail...
    - URLs, Filters and the Rails Action Controller
    - Flash and the Rails Action Controller
    - Rails Action Controller
    - Dropping and Sorting with AJAX and script.ac...
    - Drag and Drop with script.aculo.us and Rails
    - Introducing script.aculo.us
    - Ruby Classes and Objects
    - Ruby Loops
    - Ruby Conditionals
    - Ruby Operators and Arrays
    - Ruby for the Newbie







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway