Homework 3: Adding More Ruby

For this homework assignment, you will expand upon what you learned about creating a website and add more dynamic content to your individual project using Ruby.  

You may add any dynamic functionality to the site that you think is appropriate for your project.  If you cannot think of anything, I do have some suggestions at the bottom of this page as well as a link to a tutorial on creating a randomized dice roller.  

Reading and Resources

What to Do

  1. Modify an existing page aka “view” (and associated controller) to use Ruby to create dynamic content OR create a new controller and view to add similar content
  2. Your dynamic content can be triggered by a page load, particularly if you are generating random content such as a die roll, a random quotation, or serving up a random image.  At this point, you do not need to use an event handler that the user triggers with a button click.

Dynamic Content Ideas

At this point, having something randomly change every time the page reloads is the easiest way to make a page dynamic.  We’ll tackle making your page respond to the user in a later homework assignment.  Since you do not have a model/SQL database yet, use an array embedded in your code to serve up “randomly” chosen content.

  • Magic 8 Ball
  • Mad Libs style page
  • Poker hand dealer
  • Yahtzee dice roller
  • Random fortune giver
  • Daily horoscope (see this Stack Overflow thread)
  • Random quote generator
  • Random image display
  • Dice Roller, but add additional functionality such as using several dice or changing the number of faces

What to Hand In

  1. Similar to prior homework assignments,  submit a document that contains links to your GitHub repo (showing a new commit with “HW3” as part of the commit message
  2. In the same document, include the link to the Heroku app.  

Scoring Rubric (10 points)

  1. New or modified controller
  2. New or modified view (i.e. web page)
  3. Embedded Ruby
  4. Something dynamic 
  5. Button click or link on the site takes you to the dynamic page (if your code executes during a page load, make sure your navigation bar has a link to that page)
  6. On GitHub
  7. On Heroku (or other host)
  8. Link to the site/app and not the dashboard!!
  9. Look and feel is consistent from page to page
  10. Consistent navigation bar on all pages
  11. The new content has something to do with the rest of the site or page (extra credit)
The views and opinions expressed on individual web pages are strictly those of their authors and are not official statements of Grinnell College. Copyright Statement.