module EncryptedStore::ActiveRecord::Mixin::ClassMethods

Public Instance Methods

_encrypted_store_data() click to toggle source
# File lib/encrypted_store/active_record/mixin.rb, line 25
def _encrypted_store_data
  @_encrypted_store_data ||= {}
end
attr_encrypted(*args) click to toggle source
# File lib/encrypted_store/active_record/mixin.rb, line 29
def attr_encrypted(*args)
  # Store attrs in class data
  _encrypted_store_data[:encrypted_attributes] = args.map(&:to_sym)

  args.each do |arg|
    self.attribute(arg) if self.respond_to?(:attribute)
    define_method(arg) { _encrypted_store_get(arg) }
    define_method("#{arg}=") { |value| _encrypted_store_set(arg, value) }
  end
end