From a8b89acec18abc6fecc5513ae62bbeccfd27edec Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Fri, 23 Dec 2011 13:05:58 -0200 Subject: [PATCH] Updating action when article is updated --- app/models/article.rb | 5 +++-- app/views/profile/_comment.rhtml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/article.rb b/app/models/article.rb index 4d78f13..711734b 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -2,7 +2,7 @@ require 'hpricot' class Article < ActiveRecord::Base - track_actions :create_article, :after_create, :keep_params => [:name, :url, :lead, :id], :if => Proc.new { |a| a.is_trackable? && !a.image? }, :custom_target => :action_tracker_target + track_actions :create_article, :after_create, :keep_params => [:name, :url, :lead], :if => Proc.new { |a| a.is_trackable? && !a.image? } # xss_terminate plugin can't sanitize array fields before_save :sanitize_tag_list @@ -135,7 +135,8 @@ class Article < ActiveRecord::Base after_update :update_creation_activity def update_creation_activity - #update article's activity + action = ActionTracker::Record.find(:first, :conditions => {:target_type => 'Article', :target_id => self.id}) + action.touch end # retrieves all articles belonging to the given +profile+ that are not diff --git a/app/views/profile/_comment.rhtml b/app/views/profile/_comment.rhtml index 8eb871b..0c712b9 100644 --- a/app/views/profile/_comment.rhtml +++ b/app/views/profile/_comment.rhtml @@ -19,7 +19,7 @@ <%= txt2html comment.body %>
- <%= show_time(comment.created_at) %> + <%= time_ago_as_sentence(comment.created_at) %>
-- libgit2 0.21.2