False The REST principle can be applied to any kind of operation as long as the

False the rest principle can be applied to any kind

This preview shows page 94 - 96 out of 517 pages.

False. The REST principle can be applied to any kind of operation, as long as the app represents its entities as resources and specifies what operations are allowed on each type of resource. Self-Check 2.7.2. True or false: Supporting RESTful operations simplifies integrating a SaaS app with other services in a Service-Oriented Architecture. True.
Image of page 94
2.8 500 Feet: Template Views We conclude our brief tour with a look at views. Because user-facing SaaS applications primarily deliver HTML pages, most frameworks provide a way to create a page of static markup (HTML or otherwise) interspersed with variables or very brief snippets of code. At runtime, the variable values or results of code execution are substituted or interpolated into the page. This architecture is known as Template View, and it is the basis of many SaaS frameworks including Rails, Django, and PHP. We prefer Haml’s conciseness to Rails’ built-in erb templating system, so Haml is preinstalled with the bookware. We will use a templating system called Haml (for HTML Abstraction Markup Language, pronounced “HAM-ell”) to streamline the creation of HTML template views. We will learn more details and create our own views in Chapter 4 , but in the interest of visiting all the “moving parts” of a Rails app, open app/views/movies/index.html.haml in the RottenPotatoes directory. This is the view used by the Index controller action on movies; by convention over configuration, the suffixes .html.haml indicate that the view should be processed using Haml to create index.html , and the location and name of the file identify it as the view for the index action in the movies controller. Screencast 2.8.1 presents the basics of Haml, summarized in Figure 2.14 . Screencast 2.8.1: Interpolation into views using Haml In a Haml template, lines beginning with % expand into the corresponding HTML opening tag, with no closing tag needed since Haml uses indentation to determine structure. Ruby-like hashes following a tag become HTML attributes. Lines –beginning with a dash are executed as Ruby code with the result discarded, and lines =beginning with an equals sign are executed as Ruby code with the result interpolated into the HTML output. Haml HTML %br{:clear => ’left’} <br clear=”left”/> %p.foo Hello <p class=”foo”>Hello</p> %p#foo Hello <p id=”foo”>Hello</p> .foo <div class=”foo”>. . . </div> #foo.bar <div id=”foo” class=”bar”>. . . </div> Figure 2.14: Some commonly used Haml constructs and the resulting HTML. A Haml tag beginning with % must either contain the tag and all its content on a single line, as in lines 1–3 of the table, or must appear by itself on the line as in lines 4–5, in which case all of the tag’s content must be indented by 2 spaces on subsequent lines. Notice that Haml specifies class and id attributes using a notation deliberately similar to CSS selectors.
Image of page 95
Image of page 96

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors