Module: BlsmVdCore::EncryptedId

Extended by:
ActiveSupport::Concern
Included in:
Order
Defined in:
lib/blsm-vd-core/model/encrypted_id.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

CIPHER_NAME =
'aes-256-cbc'
CIPHER_IV =
['1e5673b2572af26a8364a50af84c7d2a'].pack('H*')

Instance Method Summary collapse

Instance Method Details

#reload(options = nil) ⇒ Object



78
79
80
81
# File 'lib/blsm-vd-core/model/encrypted_id.rb', line 78

def reload(options = nil)
  options = (options || {}).merge(:no_encrypted_id => true)
  super(options)
end

#to_keyObject



70
71
72
73
74
75
76
# File 'lib/blsm-vd-core/model/encrypted_id.rb', line 70

def to_key
  key = self.id or nil
  if key
    key = [self.class.encrypt(self.class.encrypted_id_key, self.id)]
  end
  key
end

#to_paramObject



66
67
68
# File 'lib/blsm-vd-core/model/encrypted_id.rb', line 66

def to_param
  self.class.encrypt(self.class.encrypted_id_key, self.id)
end