上映会のし組み作り(#295) (#296)
#295 #295 #295 #295 #295 #295 #295 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #296
This commit was merged in pull request #296.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class TheatreWatchingUser < ApplicationRecord
|
||||
self.primary_key = :theatre_id, :user_id
|
||||
|
||||
belongs_to :theatre
|
||||
belongs_to :user
|
||||
|
||||
scope :active, -> { where('expires_at >= ?', Time.current) }
|
||||
scope :expired, -> { where('expires_at < ?', Time.current) }
|
||||
|
||||
def active? = expires_at >= Time.current
|
||||
|
||||
def refresh! = update!(expires_at: 30.seconds.from_now)
|
||||
end
|
||||
Reference in New Issue
Block a user