summaryrefslogtreecommitdiff
path: root/app/models/event.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-17 21:23:43 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-17 21:23:43 +0300
commitb3a90aba41a040378530cb9f1980497e16bbdb11 (patch)
treeae8d7db8994ad89a2469eb59280df2b40cca20fd /app/models/event.rb
parente44e2316c3e223955847859492f6f9bd7974e50e (diff)
downloadgitlab-ce-b3a90aba41a040378530cb9f1980497e16bbdb11.tar.gz
Remove ProjectActivityCacheObserver
Diffstat (limited to 'app/models/event.rb')
-rw-r--r--app/models/event.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/event.rb b/app/models/event.rb
index b88635ccb59..92ad70f4eea 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -41,6 +41,9 @@ class Event < ActiveRecord::Base
# For Hash only
serialize :data
+ # Callbacks
+ after_create :reset_project_activity
+
# Scopes
scope :recent, -> { order("created_at DESC") }
scope :code_push, -> { where(action: PUSHED) }
@@ -303,4 +306,10 @@ class Event < ActiveRecord::Base
target.respond_to? :title
end
end
+
+ def reset_project_activity
+ if project
+ project.update_column(:last_activity_at, event.created_at)
+ end
+ end
end