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



10
11
12
# File 'app/models/spotlight/lock.rb', line 10

def current_session!
  @current_session = true
end

#current_session?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/models/spotlight/lock.rb', line 14

def current_session?
  !!@current_session
end

#stale?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/spotlight/lock.rb', line 18

def stale?
  created_at < (12.hours.ago)
end