1
0
Fork 0
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:
Matt Jankowski 2024-07-30 16:55:40 -04:00
parent 6274bfaf74
commit f15e96c1b8

View file

@ -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)