Sha256: d9d8c2af6d20f59aeec7e97a04833330afcf4d98b071bd0711edd217c52edd45

Contents?: true

Size: 424 Bytes

Versions: 29

Compression:

Stored size: 424 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  ##
  # Page-level locking to discourage update conflicts
  class Lock < ActiveRecord::Base
    belongs_to :on, polymorphic: true
    belongs_to :by, polymorphic: true, optional: true

    def current_session!
      @current_session = true
    end

    def current_session?
      !!@current_session
    end

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

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
blacklight-spotlight-4.7.0 app/models/spotlight/lock.rb
blacklight-spotlight-4.6.1 app/models/spotlight/lock.rb
blacklight-spotlight-4.6.0 app/models/spotlight/lock.rb
blacklight-spotlight-4.5.0 app/models/spotlight/lock.rb
blacklight-spotlight-4.4.0 app/models/spotlight/lock.rb
blacklight-spotlight-4.3.6 app/models/spotlight/lock.rb
blacklight-spotlight-4.3.5 app/models/spotlight/lock.rb
blacklight-spotlight-4.3.4 app/models/spotlight/lock.rb
blacklight-spotlight-4.3.3 app/models/spotlight/lock.rb
blacklight-spotlight-4.3.2 app/models/spotlight/lock.rb
blacklight-spotlight-4.3.1 app/models/spotlight/lock.rb
blacklight-spotlight-4.3.0 app/models/spotlight/lock.rb
blacklight-spotlight-4.2.0 app/models/spotlight/lock.rb
blacklight-spotlight-4.1.2 app/models/spotlight/lock.rb
blacklight-spotlight-4.1.1 app/models/spotlight/lock.rb
blacklight-spotlight-4.1.0 app/models/spotlight/lock.rb
blacklight-spotlight-4.0.3 app/models/spotlight/lock.rb
blacklight-spotlight-4.0.2 app/models/spotlight/lock.rb
blacklight-spotlight-4.0.1 app/models/spotlight/lock.rb
blacklight-spotlight-4.0.0 app/models/spotlight/lock.rb