Sha256: 861bb2b320c51546e5ec548d32d95605c9891850afeab74c00be8f0f1b48da3f

Contents?: true

Size: 593 Bytes

Versions: 3

Compression:

Stored size: 593 Bytes

Contents

module CloseEncounters
  class ParticipantService < ApplicationRecord
    has_many :events,
      inverse_of: :participant_service,
      class_name: "CloseEncounters::ParticipantEvent"

    validates :name, presence: true

    # ONLY encrypt if you have the necessary keys
    if Rails.application.credentials.close_encounters_encryption_key.present?
      encrypts :connection_info
    end

    def connection_info
      if super.is_a?(String)
        JSON.parse(super)
      else
        super
      end
    end

    def connection_info=(value)
      super(value.to_json)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
close_encounters-0.2.1 app/models/close_encounters/participant_service.rb
close_encounters-0.2.0 app/models/close_encounters/participant_service.rb
close_encounters-0.1.3 app/models/close_encounters/participant_service.rb