Commit 9ebbcb8f authored by Andreas Brandl's avatar Andreas Brandl

Operate on ids to avoid unnecessary loading.

parent 11a559f7
......@@ -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
......@@ -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.
......@@ -55,6 +55,6 @@ describe UserInteractedProject do
it { validate_presence_of(:project) }
it { validate_presence_of(:user) }
it { validate_presence_of(:project_id) }
it { validate_presence_of(:user_id) }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment