mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Use arel order in session activation
This commit is contained in:
parent
6274bfaf74
commit
f15e96c1b8
1 changed files with 3 additions and 1 deletions
|
@ -28,6 +28,8 @@ class SessionActivation < ApplicationRecord
|
|||
|
||||
before_create :assign_access_token
|
||||
|
||||
scope :latest, -> { order(created_at: :desc) }
|
||||
|
||||
class << self
|
||||
def active?(id)
|
||||
id && exists?(session_id: id)
|
||||
|
@ -46,7 +48,7 @@ class SessionActivation < ApplicationRecord
|
|||
end
|
||||
|
||||
def purge_old
|
||||
order('created_at desc').offset(Rails.configuration.x.max_session_activations).destroy_all
|
||||
latest.offset(Rails.configuration.x.max_session_activations).destroy_all
|
||||
end
|
||||
|
||||
def exclusive(id)
|
||||
|
|
Loading…
Reference in a new issue