diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-03-05 16:50:05 +0100 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-03-06 12:53:15 +0100 |
commit | 9ebbcb8f8b401d2a49cfec6b9cb55bf9703d8180 (patch) | |
tree | 0b87b1cc157b4b431b0480ac183ac9992251b372 /app/models | |
parent | 11a559f7c9ce21b040c3a9c0544169f4885b9fa6 (diff) | |
download | gitlab-ce-9ebbcb8f8b401d2a49cfec6b9cb55bf9703d8180.tar.gz |
Operate on ids to avoid unnecessary loading.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user_interacted_project.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/user_interacted_project.rb b/app/models/user_interacted_project.rb index 5e7f6d5eeda..5d661018a9d 100644 --- a/app/models/user_interacted_project.rb +++ b/app/models/user_interacted_project.rb @@ -2,8 +2,8 @@ class UserInteractedProject < ActiveRecord::Base belongs_to :user belongs_to :project - validates :project, presence: true - validates :user, presence: true + validates :project_id, presence: true + validates :user_id, presence: true CACHE_EXPIRY_TIME = 1.day @@ -15,7 +15,7 @@ class UserInteractedProject < ActiveRecord::Base # For events without a project, we simply don't care. # An example of this is the creation of a snippet (which # is not related to any project). - return unless event.project + return unless event.project_id # This is a precaution because the cache lookup # will work just fine without an author. |