Module: EncryptedId::ClassMethods
- Defined in:
- lib/encrypted_id.rb
Instance Method Summary collapse
Instance Method Details
#encrypted_id_default_key ⇒ Object
50 51 52 |
# File 'lib/encrypted_id.rb', line 50 def encrypted_id_default_key name end |
#find(*args) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/encrypted_id.rb', line 32 def find(*args) scope = args.slice!(0) = args.slice!(0) || {} if !(scope.is_a? Symbol) && has_encrypted_id? && ![:no_encrypted_id] begin scope = EncryptedId.decrypt(encrypted_id_key, "#{scope}") rescue OpenSSL::Cipher::CipherError raise ActiveRecord::RecordNotFound.new("Could not decrypt ID #{args[0]}") end end .delete(:no_encrypted_id) super(scope, ) end |
#has_encrypted_id? ⇒ Boolean
46 47 48 |
# File 'lib/encrypted_id.rb', line 46 def has_encrypted_id? true end |