To Examples

GuestBook Directions

 

  1. Create a new rails project named GuestBook.
     
  2. Navigate to the GuestBook folder.
     
  3. Generate a model named Comment with these fields:
     
    Field Datatype
    name string
    message text

     
  4. Enter this rake statement to create the database:
  5. Generate a controller with name Comments with views new and display_all.
     
  6. Use this code for the controller comments_controller.rb.
     
  7. Use this code for the views new.html.erb and display_all.html.erb.
     
  8. Add a post route to the config/routes.rb file:
  9. Add a layout page and a CSS style file.
     
  10. View the display_orders view in a browser at this URL: