CIT 597 Quiz 9: Rails
Fall 2008, David Matuszek Name_________________________________________
  1. (15 points) Rails is based on three philosophical principles. What are they? (Just name, don't describe.)
    Convention over configuration
    Don't Repeat Yourself (DRY)
    Agile development

  2. (15 points) Rails uses three environments. What are they? (Just name, don't describe.)

    development, test, production


  3. (10 points) A Rails controller method must end in one of two ways. What are they?
    Passing control to another controller method, OR
    Passing control to a view template


  4. (10 points) An .rhtml file is a Ruby HTML file. Tell how to include...
    1. ...executable statements that do computations but do not produce output:
      Enclose statements in   <%   %>

    2. ...expressions whose value is to be inserted into the.rhtml page:
      Enclose statements in   <%=   %>

  5. (20 points) Briefly define the following terms:
    1. layout
      A template file for an HTML (.rhtml) page
    2. partial
      A template file for just a part of an HTML (.rhtml) page
    3. fixture
      A set of data for a test
    4. migration
      A way to write the database in Ruby, avoiding SQL
  6. (5 points) Briefly, what does Ruby's h method do?

    Replaces &, ", <, and > with &amp;, &quot;, &lt;, and &gt;, respectively.

  7. (5 points) What is the one thing that Rails cannot do when creating a web application?
    Create the initial SQL database.

  8. (10 points) Name the two kinds of scripting command used by Rails.
    generate and rake

  9. (5 points) A validation checks the legality of something. What is that something?
    a requested database entry or update

  10. (5 points) What is YAML used to describe?
    Ruby objects
    (4 points partial credit if the answer is: fixtures)