Add scope for unexpired user tokens
This commit is contained in:
parent
4c029873bb
commit
b42d48ff65
1 changed files with 2 additions and 0 deletions
|
@ -21,6 +21,8 @@
|
|||
class UserToken < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
scope :unexpired, -> { where("expiry >= now()") }
|
||||
|
||||
after_initialize :set_defaults
|
||||
|
||||
def expired?
|
||||
|
|
Loading…
Add table
Reference in a new issue