Home arrow Ruby-on-Rails arrow Understanding Action Views in Ruby-on-Rails
RUBY-ON-RAILS

Understanding Action Views in Ruby-on-Rails


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.

Author Info:
By: A.P.Rajshekhar
Rating: 5 stars5 stars5 stars5 stars5 stars / 12
August 15, 2006
TABLE OF CONTENTS:
  1. · Understanding Action Views in Ruby-on-Rails
  2. · ActionView: Templates and Formatting Helpers
  3. · ActionView: Pagination and Layouts
  4. · Rails in the Real World

print this article
SEARCH DEVARTICLES

Understanding Action Views in Ruby-on-Rails
(Page 1 of 4 )

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.


blog comments powered by Disqus
RUBY-ON-RAILS ARTICLES

- Ruby-on-Rails Faces Second Security Flaw in ...
- Ruby 2.0 Prepped for February 2013 Release
- Why LinkedIn Switched from Ruby on Rails
- Adding Style with Action Pack
- Handling HTML in Templates with Action Pack
- Filters, Controllers and Helpers in Action P...
- Action Pack and Controller Filters
- Action Pack Categories and Events
- Logging Out, Events and Templates with Actio...
- Action Pack Sessions and Architecture
- More on Action Pack Partial Templates
- Action Pack Partial Templates
- Displaying Error Messages with the Action Pa...
- Action Pack Request Parameters
- Creating an Action Pack Registration Form

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials