This commit is contained in:
Toks
2013-04-04 10:48:24 -04:00
parent 1132470c65
commit 0ac6316aff

View File

@@ -7,7 +7,7 @@ class Comment < ActiveRecord::Base
has_many :votes, :class_name => "CommentVote", :dependent => :destroy
before_validation :initialize_creator, :on => :create
before_validation :initialize_updater
after_save :update_last_commented_at_on_save
after_create :update_last_commented_at_on_create
after_destroy :update_last_commented_at_on_destroy
attr_accessible :body, :post_id, :do_not_bump_post
attr_accessor :do_not_bump_post
@@ -108,7 +108,7 @@ class Comment < ActiveRecord::Base
true
end
def update_last_commented_at_on_save
def update_last_commented_at_on_create
if Comment.where("post_id = ?", post_id).count <= Danbooru.config.comment_threshold && !do_not_bump_post?
Post.update_all(["last_commented_at = ?", created_at], ["id = ?", post_id])
end