* Missing files

* Work on post exploration code by traversing dates
This commit is contained in:
albert
2010-10-27 20:16:43 -04:00
parent f9cdcef2c0
commit fc0a076aca
32 changed files with 371 additions and 189 deletions

View File

@@ -644,15 +644,15 @@ class Post < ActiveRecord::Base
!votes.exists?(["user_id = ?", user.id])
end
def vote!(user, is_positive)
if can_be_voted_by?(user)
if is_positive
def vote!(score)
if can_be_voted_by?(CurrentUser.user)
if score == "up"
increment!(:score)
else
elsif score == "down"
decrement!(:score)
end
votes.create(:user_id => user.id)
votes.create(:score => score)
else
raise PostVote::Error.new("You have already voted for this comment")
end