Module: PGCrypto::HasEncryptedColumn

Defined in:
lib/pgcrypto/has_encrypted_column.rb

Instance Method Summary collapse

Instance Method Details

#has_encrypted_column(*column_names) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/pgcrypto/has_encrypted_column.rb', line 3

def has_encrypted_column(*column_names)
  options = column_names.extract_options!
  options.reverse_merge(type: :pgp)

  column_names.each do |column_name|
    # Stash the encryption type in our module
    PGCrypto[table_name][column_name.to_s] ||= options.symbolize_keys
  end
end

#pgcrypto(*args) ⇒ Object



13
14
15
16
17
18
# File 'lib/pgcrypto/has_encrypted_column.rb', line 13

def pgcrypto(*args)
  if defined? Rails
    Rails.logger.debug "[DEPRECATION WARNING] `pgcrypto' is deprecated. Please use `has_encrypted_column' instead!"
  end
  has_encrypted_column(*args)
end