diff options
author | Nick Thomas <nick@gitlab.com> | 2019-03-13 16:42:43 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-03-13 16:42:43 +0300 |
commit | 9f05e97aad33a0cd70862f67101bdcb3fddc639a (patch) | |
tree | a9868d2c6711ebff1dcbb06f6d09f91d15caa631 /app/models/user_interacted_project.rb | |
parent | 5ed9c5f7f74d7305bb884a6ae7a601d4563398a4 (diff) |
Run rubocop -a
Diffstat (limited to 'app/models/user_interacted_project.rb')
-rw-r--r-- | app/models/user_interacted_project.rb | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/app/models/user_interacted_project.rb b/app/models/user_interacted_project.rb index ae6778e49be..5fc59b274f5 100644 --- a/app/models/user_interacted_project.rb +++ b/app/models/user_interacted_project.rb @@ -26,16 +26,14 @@ class UserInteractedProject < ActiveRecord::Base cached_exists?(attributes) do transaction(requires_new: true) do - begin - where(attributes).select(1).first || create!(attributes) - true # not caching the whole record here for now - rescue ActiveRecord::RecordNotUnique - # Note, above queries are not atomic and prone - # to race conditions (similar like #find_or_create!). - # In the case where we hit this, the record we want - # already exists - shortcut and return. - true - end + where(attributes).select(1).first || create!(attributes) + true # not caching the whole record here for now + rescue ActiveRecord::RecordNotUnique + # Note, above queries are not atomic and prone + # to race conditions (similar like #find_or_create!). + # In the case where we hit this, the record we want + # already exists - shortcut and return. + true end end end |