mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-21 06:15:31 +08:00
Optimize data query in user_notification.rb
This commit is contained in:
parent
c37885692d
commit
56d2240de5
1 changed files with 1 additions and 4 deletions
|
@ -23,9 +23,6 @@ class UserNotification < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.seen_by_user(user)
|
||||
where(user: user).map do |n|
|
||||
n.checked = true
|
||||
n.save
|
||||
end
|
||||
where(user: user).where(checked: false).update_all(checked: true)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue