Self-Check Questions

Test Yourself!

Complete these questions to earn credit for the assignment.

Select one answer from questions with circle bubbles. Select all that apply from questions with square bubbles.

  1. What is the goal of running bundle install? (Submit via your course’s platform to get credit.)
  2. Why is it good practice to specify --without production when running bundle install on your development computer? (Submit via your course’s platform to get credit.)
  3. What file in the Rails app directory structure is the code corresponding to the WordGuesserGame model? (Submit via your course’s platform to get credit.)
  4. In what file is the code that most closely corresponds to the logic in the Sinatra apps’ app.rb file that handles incoming user actions? (Submit via your course’s platform to get credit.)
  5. What class contains that code (the code in Question 4)? (Submit via your course’s platform to get credit.)
  6. From what other class (which is part of the Rails framework) does that class inherit? (Submit via your course’s platform to get credit.)
  7. In what directory is the code corresponding to the Sinatra app’s views (new.erb, show.erb, etc.)? (Submit via your course’s platform to get credit.)
  8. The filename suffixes for these views are different in Rails than they were in the Sinatra app. What information does the rightmost suffix of the filename (e.g.: in foobar.abc.xyz, the suffix .xyz) tell you about the file contents? (Submit via your course’s platform to get credit.)
  9. What information does the other suffix tell you about what Rails is being asked to do with the file? (Submit via your course’s platform to get credit.)
  10. In what file is the information in the Rails app that maps routes (e.g. GET /new) to controller actions? (Submit via your course’s platform to get credit.)
  11. What is the role of the :as => 'name' option in the route declarations of config/routes.rb? (Hint: look at the views.) (Submit via your course’s platform to get credit.)
  12. In the Sinatra version, before do...end and after do...end blocks are used for session management. What is the closest equivalent in this Rails app, and in what file do we find the code that does it? (Submit via your course’s platform to get credit.)
  13. In the Sinatra version, each controller action ends with either redirect (which as you can see becomes redirect_to in Rails) to redirect the player to another action, or erb to render a view. Why are there no explicit calls corresponding to erb in the Rails version? (Hint: Based on the code in the app, can you discern the Convention-over-Configuration rule that is at work here?) (Submit via your course’s platform to get credit.)
  14. In the Sinatra version, we directly coded an HTML form using the <form> tag, whereas in the Rails version we are using a Rails method form_tag, even though it would be perfectly legal to use raw HTML <form> tags in Rails. Can you think of a reason Rails might introduce this “level of indirection”? (Submit via your course’s platform to get credit.)
  15. How are form elements such as text fields and buttons handled in Rails? (Again, raw HTML would be legal, but what’s the motivation behind the way Rails does it?) (Submit via your course’s platform to get credit.)
  16. In the Sinatra version, the show, win, and lose views re-use the code in the new view that offers a button for starting a new game. Which of the following Rails mechanisms allow those views to be re-used in the Rails version? (Select all that apply.) (Submit via your course’s platform to get credit.)
  17. What is a qualitative explanation for why the Cucumber scenarios and step definitions didn’t need to be modified at all to work equally well with the Sinatra or Rails versions of the app? Note that the Sinatra and Rails apps appear the same to a user. (Submit via your course’s platform to get credit.)

When you are done with the assignment, please remember to mark as complete.


This site uses Just the Docs, a documentation theme for Jekyll.