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
|
class UserToken < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
scope :unexpired, -> { where("expiry >= now()") }
|
||||||
|
|
||||||
after_initialize :set_defaults
|
after_initialize :set_defaults
|
||||||
|
|
||||||
def expired?
|
def expired?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue