small medium large xlarge

Generic-user-small
23 Jun 2010, 00:51
Malcolm Arnold (21 posts)

Sam, thanks for answering all these questions.

LINE READS: In Rails, dynamic content is generated by templates, which come in three flavors

SUGGESTED LINE: In Rails, dynamic content is generated by templates, which come in three flavors: Embedded Ruby, XML Documents, and RJS views.

If I understand the entire text below correctly, the about sentence refers to XML Documents and RJS views which are mentioned in the following 2 paragraphs. Using the suggested line makes it clearer.

FULL TEXT OF THE 3 PARAGRAPHS. In Rails, dynamic content is generated by templates, which come in three flavors. The most common templating scheme, called Embedded Ruby (ERb), embeds snippets of Ruby code within a view document, in many ways similar to the way it is done in other web frameworks, such as PHP or JSP. While this approach is very flexible, some are concerned that it violates the spirit of MVC. By embedding code in the view, we risk adding logic that should be in the model or the controller. As with everything, while judicious use in moderation is healthy, overuse can become a problem. Maintaining a clean separation of concerns is part of the job of the developer. (We look at HTML templates in Section 20.1, templates, on page 270.) XML Builder can also be used to construct XML documents using Ruby code— the structure of the generated XML will automatically follow the structure of the code. We discuss xml.builder templates starting on page 273. Rails also provides RJS views. These allow you to create JavaScript fragments on the server that are then executed on the browser. This is great for creating dynamic Ajax interfaces. We talk about these starting on page 270.

You must be logged in to comment