编辑文章后,或者回复文章后,更新组织动态的更新时间

This commit is contained in:
ouyangxuhua 2015-11-20 16:16:46 +08:00
parent d77d4a421b
commit 5cfc8c2f8d
2 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,10 @@ class OrgDocumentCommentsController < ApplicationController
def update
@org_document = OrgDocumentComment.find(params[:id])
@org_document.update_attributes(:title => params[:org_document_comment][:title], :content => params[:org_document_comment][:content])
if @org_document.parent.nil?
act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", @org_document.id).first
act.update_attributes(:updated_at => @org_document.updated_at)
end
respond_to do |format|
format.html {redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id)}
end

View File

@ -11,6 +11,10 @@ class OrgDocumentComment < ActiveRecord::Base
def document_save_as_org_activity
if(self.parent().nil?)
self.org_acts << OrgActivity.new(:user_id => User.current.id, :container_id => self.organization.id, :container_type => 'Organization')
else
act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", self.root.id).first
act.update_attributes(:updated_at => self.updated_at)
end
end
end