To Examples

OnlineQuiz Directions

 

  1. Create a new rails project named OnlineQuiz.
     
  2. Navigate to the OnlineQuiz folder.
     
  3. Generate a model named Answer with these fields:
     
    Field Datatype
    name string
    ans1 string
    ans2 string
    ans3 string
    ans4 string
    ans5 string

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