To Lecture Notes

IT 231 -- 9/18/12

Review Questions

  1. What is the difference betweeen these pairs of Rails delimiters:
    Ans: ERB delimiters are used to call Rails helper functions or insert variable values into a view or layout. Use <%= ... %> when calling a Rails method that generates HTML code. Use <% ... %> when calling an ERB control method.
     
  2. Write Rails helper functions to
     
  3. Identify the parts of this URL:
    Ans: protocol; server name; port number; controller; action; id
     
  4. You enter the following URL in a browser, but the corresponding page does not display properly. List some things that might be wrong?
    Ans:
    1. You might have saved the view or layout properly.
    2. You might not have started the server.
    3. You didn't wait long enough for the server to startup before viewing the page.
    4. You didn't convert the controller name to underscore notation before trying to use it as a URL.
    5. The controller name includes an uppercase letter.
    6. You don't have a proper end title tag.
    7. You are missing an ending ERB delimiter.

     
  5. What does this ERB statment do?
    Ans: It marks where the view is to be inserted into a layout page.
     
  6. Add a new view named contact_us to the Info controller of the Library project. This involves these three tasks:
     
    1. Add the new view contact_us.html.erb file to the folder app/views/info.
       
    2. Add a new method named contact_us in the the contact_us_controller.rb file in app/controllers.
       
    3. Add a new get route in the routes.rb file in app/config.

 

The Controller Class

 

Alternative Forms for Helper Methods

  1. image_tag method
    Reference: api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html
     
  2. stylesheet_link_tag method
    Reference: api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html
     
  3. link_to method
    Reference: api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html

 

Datatypes Used by Rails Scaffold-based Projects

 

Projects Created by the Rails Scaffold Software

 

Project 2

 

Routing

 

Modifying the Dropdown Menus for Selecting a Date

 

Validations

 

Rails Databases and Migrations