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
- Hartl Chapter 4 on Rails-Flavored Ruby
- Dice Roller tutorial at Medium.com
What to Do
- 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
- 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
- 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
- In the same document, include the link to the Heroku app.
Scoring Rubric (10 points)
- New or modified controller
- New or modified view (i.e. web page)
- Embedded Ruby
- Something dynamic
- 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)
- On GitHub
- On Heroku (or other host)
- Link to the site/app and not the dashboard!!
- Look and feel is consistent from page to page
- Consistent navigation bar on all pages
- The new content has something to do with the rest of the site or page (extra credit)