Sha256: 0ab169e59fc19a48589b8ca7914d3a2a8146f5b6eac80f8389510225f5bbfcfc

Contents?: true

Size: 526 Bytes

Versions: 1

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

module Consent
  class History < ::Consent::ApplicationRecord
    enum command: { grant: "grant", revoke: "revoke" }

    serialize :subject, ::Consent::SubjectCoder
    validates :subject, presence: true
    validates :action, presence: true
    validates :view, presence: true
    validates :command, presence: true

    def self.record(command, permission)
      create!(
        **permission.slice(:role_id, :subject, :action, :view),
        command: command.to_s
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
consent-2.0.0 app/models/consent/history.rb