Extra Credit
If you got all the way through Suggestotron with some time to spare, here's some extra stuff you can try:
- Add a downvote button that does the opposite of what the upvote button does
- Sort topics by their number of votes
- Add an 'about' page, linked from the bottom of the Suggestotron topics list. Link back to the Topics list from the About page so users don't get stranded.
- If your class has a lot of time left over:
- Users should be allowed to vote only once: give votes a user_id and allow a user to have voted on each topic only once. But wait, what is a 'user' in our system? Get a volunteer to introduce everyone to Devise, a simple way to add authentication to a Rails application.
- Users should be able to give a post a 'negative' vote instead of a positive one. How might you represent that in this system?
It's Broken! Fix it!
How about you let your teacher break the app you just wrote? We guess you are asking yourself "why would I do that?".
Well, debugging is a big part of every developer's day.
Debugging is the process where you find the problem that causes your application to misbehave or to stop working altogether.
This is a special skill that you will develop throughout your programming career and is hardly ever learnt from a book. It
takes time, patience, and hard work to improve your debugging skill.
The exercises below will give you a sneak peek of how the debugging process is usually done. Call a teacher and let's take a look at three fragile points of every Rails application: