Merge branch 'master' of github.com:r888888888/danbooru

This commit is contained in:
albert
2013-04-04 11:23:23 -04:00

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