Class: Spotlight::Lock

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/spotlight/lock.rb

Overview

Page-level locking to discourage update conflicts

Instance Method Summary collapse

Instance Method Details

#current_session!Object



8
9
10
# File 'app/models/spotlight/lock.rb', line 8

def current_session!
  @current_session = true
end

#current_session?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/models/spotlight/lock.rb', line 12

def current_session?
  !!@current_session
end

#stale?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/models/spotlight/lock.rb', line 16

def stale?
  created_at < (Time.zone.now - 12.hours)
end