Handle money in databaes and javascript

This commit is contained in:
Tyler Renelle
2012-02-04 14:40:45 -05:00
parent 46e6a6f2ac
commit b4408f8cb7
8 changed files with 39 additions and 7 deletions
+5
View File
@@ -80,6 +80,11 @@ class HabitsController < ApplicationController
def vote
@habit = current_user.habits.find(params[:id])
# habit.vote() saves money to the user, this hack prevents having to
# reload current_user to catch that change
@habit.user=current_user
@habit.vote(params[:vote])
@score = current_user.habits.sum('score').to_i