Based on the tutorial from https://github.com/schneems/reddit_on_rails