jpalmieri/bloccit — pull request #6 by jpalmieri (2014-11-21 01:04:43+00:00)
Title: refactored post#save and #create_vote to roll back if transaction fails

>Using ActiveRecord::Base.transaction, open up a separate branch and refactor our code as follows:

>Add a save_with_initial_vote method to Post. This method should both save the post and create its vote inside a transaction, so that if the latter fails, the former doesn't occur.
Use this method in the PostsController instead of explicitly calling both save and create_vote.