Class: Consently::ConsentRecord

Inherits:
ApplicationRecord show all
Defined in:
app/models/consently/consent_record.rb

Overview

Proof that a visitor agreed to something, and to what. Optional: create it with rails g consently:consent_log and switch config.log_consents on.

Instance Method Summary collapse

Instance Method Details

#categoriesObject



10
11
12
# File 'app/models/consently/consent_record.rb', line 10

def categories
  self[:categories].to_s.split(",").map(&:to_sym)
end

#granted?(category) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/models/consently/consent_record.rb', line 14

def granted?(category)
  category.to_sym == Consent::NECESSARY || categories.include?(category.to_sym)
end