Sha256: e4082462e47426db7dba89830b8423d7614de72ef4e6bac00712433ad25c84e6

Contents?: true

Size: 770 Bytes

Versions: 2

Compression:

Stored size: 770 Bytes

Contents

module Orchestrator
    class AccessLog < Couchbase::Model
        design_document :alog
        include ::CouchbaseId::Generator


        TTL = Rails.env.production? ? 2.weeks.to_i : 120


        belongs_to :user,      class_name: "::User"
        attribute  :systems,   default: lambda { [] }

        attribute :persisted,  default: false
        attribute :suspected,  default: false
        attribute :notes

        attribute :created_at
        attribute :ended_at,   default: lambda { Time.now.to_i }


        def initialize
            super
            self.created_at = Time.now.to_i
        end

        def save
            if self.persisted
                super
            else
                super(ttl: TTL)
            end
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
orchestrator-1.0.2 app/models/orchestrator/access_log.rb
orchestrator-1.0.1 app/models/orchestrator/access_log.rb