This commit is contained in:
albert
2013-03-13 12:26:01 -04:00
parent 656d591806
commit 3a74990474
2 changed files with 3 additions and 0 deletions

View File

@@ -740,6 +740,8 @@ class Post < ActiveRecord::Base
parent.add_favorite!(User.find(user_id))
remove_favorite!(User.find(user_id))
end
update_column(:score, 0)
end
end

View File

@@ -137,6 +137,7 @@ class PostTest < ActiveSupport::TestCase
p1.reload
assert(!Favorite.exists?(:post_id => c1.id, :user_id => user.id))
assert(Favorite.exists?(:post_id => p1.id, :user_id => user.id))
assert_equal(0, c1.score)
end
should "update the parent's has_children flag" do