privacy_policy.rb 523 B

123456789101112131415161718
  1. # frozen_string_literal: true
  2. class PrivacyPolicy < ActiveModelSerializers::Model
  3. DEFAULT_PRIVACY_POLICY = Rails.root.join('config', 'templates', 'privacy-policy.md').read
  4. DEFAULT_UPDATED_AT = DateTime.new(2022, 10, 7).freeze
  5. attributes :updated_at, :text
  6. def self.current
  7. custom = Setting.find_by(var: 'site_terms')
  8. if custom&.value.present?
  9. new(text: custom.value, updated_at: custom.updated_at)
  10. else
  11. new(text: DEFAULT_PRIVACY_POLICY, updated_at: DEFAULT_UPDATED_AT)
  12. end
  13. end
  14. end