Module: Lockable
- Extended by:
- ActiveSupport::Concern
- Included in:
- CommentThread, Post
- Defined in:
- /var/apps/qpixel/app/models/concerns/lockable.rb
Instance Method Summary collapse
-
#lock_active? ⇒ Boolean
Checks whether the record has a lock & that it’s not expired.
-
#locked? ⇒ Boolean
TODO: predicate methods should not have side-effects! This is for backwards compatibility only.
Instance Method Details
#lock_active? ⇒ Boolean
Checks whether the record has a lock & that it’s not expired
12 13 14 |
# File '/var/apps/qpixel/app/models/concerns/lockable.rb', line 12 def lock_active? locked && (locked_until.nil? || !locked_until.past?) end |
#locked? ⇒ Boolean
TODO: predicate methods should not have side-effects! This is for backwards compatibility only
17 18 19 20 21 22 23 24 25 |
# File '/var/apps/qpixel/app/models/concerns/lockable.rb', line 17 def locked? return true if lock_active? if locked update(locked: false, locked_by: nil, locked_at: nil, locked_until: nil) end false end |