Solutions 8

Treasure Hunt

  1. 16: each resource generates 8 routes

  2. 2: Treasure and Comment

  3. Technically 3, although we created 2 and one is the generic application controller.

  4. Inside the controller. Routes direct to an action which is specific to a CRUD operation. The actual code is held inside these actions.

  5. The form to create a new treasure is in the new.html.erb file. The body of the form is rendered using the partial _form.html.erb.

  6. The form is rendered on the treasure show.html.erb page. The _form.html.erb in app/views/comments is used to create a new comment.

  7. The index page of treasures app/views/treasure/index.html.erb

  8. app/views/treasure/index.html.erb

    1. treasure (title:String, description:Text, created_at:datetime, updated_at:datetime)
    2. comment (bru:String, comment:Text, treasure_id:int, created_at:datetime, updated_at:datetime)
  9. schema.rb in the db folder