To Lecture Notes

Details of REST Operations

  • A table showing some of the details of REST operations when the the resources are named :items:
     
    CRUD Term Operation Helper Method Call HTTP
    Operation
    Generated
    Path
    Controller
    Method
    Read Get list of
    resource items
    link_to "Items", items_path GET /items index
    Read Get specific
    item
    link_to "Items",
        items_path(@item)
    or
    link_to "Items", @item
    GET /items/1 show
    Read Get form for
    creating new item
    link_to "Create New Item",
        new_item_path
    GET /items/new new
    Create Create new item form_for(@item) POST /items create
    Read Get completed form
    for modifying
    existing item
    link_to "Update Item",
        edit_item_path(@item)
    GET /items/1/edit edit
    Update Update existing
    item
    form_for(@item) PUT /items/1 update
    Destroy Delete existing
    item
    link_to 'Destroy', @item,
        :confirm => 'Are you sure?',
        :method => :delete
    DELETE /items/1 destroy
  •  

     

     

     

     

     

     

     

     

    Review Questions

    1. What is wrong?
    2. What is wrong?
    3. What are some possible datatypes for the fields of a Rails scaffold?
       
    4. Create a Rails project for storing movie reviews using the scaffold software.
       
    5. What does rake db:migrate do?
       
    6. In Rails when do you use upper camel casing and when do you use underscore notation?
       
    7. What is the name and location of the underlying database for a Rails project generated using a scaffold?
       
    8. If the URL for your Rails project is
    9. what happens if you switch the URL to
    10. Which views does the Rails scaffold software create?
       
    11. What does CRUD mean?

    12.  
    13. Explain the difference between yield and render.
       
    14. What does the Rails database console do for you? How can you invoke it?
       

     

    Names Created by Rails Scaffold Software

     

    Routing

     

    Modifying the Dropdown Menus for Selecting a Date

     

    Validations

     

    Moving Web Pages over the Internet

     

    Running WEBrick on a Different Port

     

    HTTP GET vs. POST

     

    Representational State Transfer