lib/encrypted_id.rb in encrypted_id-1.1.0 vs lib/encrypted_id.rb in encrypted_id-1.1.1

- old
+ new

@@ -1,7 +1,8 @@ require 'openssl' require 'active_record' +require 'encrypted_id/version' module EncryptedId CIPHER_NAME = 'aes-256-cbc' CIPHER_IV = ['1e5673b2572af26a8364a50af84c7d2a'].pack('H*') @@ -53,9 +54,17 @@ end module InstanceMethods def to_param EncryptedId.encrypt(self.class.encrypted_id_key, self.id) + end + + def to_key + key = self.id or nil + if key + key = [EncryptedId.encrypt(self.class.encrypted_id_key, self.id)] + end + key end def reload(options = nil) options = (options || {}).merge(:no_encrypted_id => true) super(options)