Commit a8b89acec18abc6fecc5513ae62bbeccfd27edec
1 parent
8ab42ad6
Exists in
master
and in
23 other branches
Updating action when article is updated
Showing
2 changed files
with
4 additions
and
3 deletions
Show diff stats
app/models/article.rb
| @@ -2,7 +2,7 @@ require 'hpricot' | @@ -2,7 +2,7 @@ require 'hpricot' | ||
| 2 | 2 | ||
| 3 | class Article < ActiveRecord::Base | 3 | class Article < ActiveRecord::Base |
| 4 | 4 | ||
| 5 | - 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 | 5 | + track_actions :create_article, :after_create, :keep_params => [:name, :url, :lead], :if => Proc.new { |a| a.is_trackable? && !a.image? } |
| 6 | 6 | ||
| 7 | # xss_terminate plugin can't sanitize array fields | 7 | # xss_terminate plugin can't sanitize array fields |
| 8 | before_save :sanitize_tag_list | 8 | before_save :sanitize_tag_list |
| @@ -135,7 +135,8 @@ class Article < ActiveRecord::Base | @@ -135,7 +135,8 @@ class Article < ActiveRecord::Base | ||
| 135 | 135 | ||
| 136 | after_update :update_creation_activity | 136 | after_update :update_creation_activity |
| 137 | def update_creation_activity | 137 | def update_creation_activity |
| 138 | - #update article's activity | 138 | + action = ActionTracker::Record.find(:first, :conditions => {:target_type => 'Article', :target_id => self.id}) |
| 139 | + action.touch | ||
| 139 | end | 140 | end |
| 140 | 141 | ||
| 141 | # retrieves all articles belonging to the given +profile+ that are not | 142 | # retrieves all articles belonging to the given +profile+ that are not |
app/views/profile/_comment.rhtml
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <%= txt2html comment.body %> | 19 | <%= txt2html comment.body %> |
| 20 | </div> | 20 | </div> |
| 21 | <div class="profile-activity-time"> | 21 | <div class="profile-activity-time"> |
| 22 | - <%= show_time(comment.created_at) %> | 22 | + <%= time_ago_as_sentence(comment.created_at) %> |
| 23 | </div> | 23 | </div> |
| 24 | </div> | 24 | </div> |
| 25 | 25 |