Other Pages

Expand All


message <<MARKDOWN
# Congratulations!
### You've just completed your first Rails app.
(Well, they're never _really_ finished... have fun tweaking it!)
And yes... you get another sticker!
If you'd like to try your hand at more coding and add useful features to your app, have a look at the extra credit section below.
tip "Help us make RailsBridge better" do
  message "Please take five minutes to [complete our (anonymous) survey](https://docs.google.com/forms/d/1ltF233clMPo4y2kul7rVmFXU_Tu9496wkDJp65Up-wA/viewform)."
  message "It's only four questions! We use your answers to do cool things. So far we've improved the documentation, got better coffee, added an overview, and lots more."
  message "Thank you!"
message <<MARKDOWN
# Extra Credit
If you got all the way through Suggestotron with some time to spare, here's some extra stuff you can try. Don't hesitate to ask a teacher for hints or explanations
### Downvote button
Users should be able to give a post a negative vote (_downvote_) instead of a positive one (_upvote_). How might you represent that in this system? Add a downvote button that does the opposite of what the current upvote button does.
### Sort topics
Sort topics by their number of votes, in descending order.
tip do
  message "You will want to modify the index method in `app/controllers/topics_controller.rb` so that `@topics` contains a sorted list of topics."
  message "Have a look at the line in the index method:"
  source_code :ruby, <<-RUBY
  @topics = Topic.all 
  message "It might change to something like this:"
  source_code :ruby, <<-RUBY
  @topics = Topic.sorted
  message "How can you add a `sorted` method to the topic model? What code do you need to put in this method to sort the topics?"
message <<MARKDOWN
### About page
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.
### One vote per user (if your class has a **lot** of time left over)
Users should be allowed to vote only once: give votes a `user_id` field and allow a user to vote on each topic only once. But wait... what is a _user_ in our system? Get a volunteer to introduce everyone to [Devise](https://github.com/plataformatec/devise), a simple way to add authentication to a Rails application.
### 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:
ol do
  li "Attributes in the attr_accessible collection"
  li "Routes"
  li "Bugs that cause unwanted behaviour, but don\'t cause the app to crash "
message <<MARKDOWN
h1 "Authors"
ul do
  li "Sarah Allen"
  li "Sarah Mei"
  li "Alex Chaffee"
  li "Ryan Davis"
  li "Steven! Ragnarok"
  li "...and many, many others"
h1 "What next?"
ul do
  li "Probably time for the closing presentation."
  li "After that, start a project, tutorial, and come back again!"
  li do
    span "All our favorite resources can be found on the RailsBridge site: "
    a "http://docs.railsbridgecapetown.org/workshop/resources", href: "http://docs.railsbridgecapetown.org/workshop/resources"

If you find something that could be improved, please make a pull request or drop us a note via GitHub Issues (no technical knowledge required).

Source: https://github.com/RailsBridge-CapeTown