博客回复后,该博客的更新时间为当前时间

dev_hjq
ouyangxuhua 9 years ago
parent 2d07801f52
commit 26f8500671

@ -127,6 +127,7 @@ class BlogCommentsController < ApplicationController
@blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
@article.children << @blogComment
@article.save
# @article.update_attribute(:updated_on, @blogComment.updated_on)
@user_activity_id = params[:user_activity_id]
user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first
if user_activity

@ -18,6 +18,7 @@ class BlogComment < ActiveRecord::Base
after_save :add_user_activity
after_update :update_activity
after_create :update_parent_time
before_destroy :destroy_user_activity
scope :like, lambda {|arg|
@ -64,6 +65,11 @@ class BlogComment < ActiveRecord::Base
(user && user.logged? && (self.author == user) ) || user.admin?
end
def update_parent_time
if !self.parent.nil?
self.root.update_attribute(:updated_on, self.updated_on)
end
end
def project
end
end

Loading…
Cancel
Save