fixes #862
This commit is contained in:
@@ -740,6 +740,8 @@ class Post < ActiveRecord::Base
|
|||||||
parent.add_favorite!(User.find(user_id))
|
parent.add_favorite!(User.find(user_id))
|
||||||
remove_favorite!(User.find(user_id))
|
remove_favorite!(User.find(user_id))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
update_column(:score, 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
p1.reload
|
p1.reload
|
||||||
assert(!Favorite.exists?(:post_id => c1.id, :user_id => user.id))
|
assert(!Favorite.exists?(:post_id => c1.id, :user_id => user.id))
|
||||||
assert(Favorite.exists?(:post_id => p1.id, :user_id => user.id))
|
assert(Favorite.exists?(:post_id => p1.id, :user_id => user.id))
|
||||||
|
assert_equal(0, c1.score)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "update the parent's has_children flag" do
|
should "update the parent's has_children flag" do
|
||||||
|
|||||||
Reference in New Issue
Block a user