Module: EncryptedId::ClassMethods
- Defined in:
- lib/encrypted_id.rb
Instance Method Summary collapse
Instance Method Details
#encrypted_id_default_key ⇒ Object
51 52 53 |
# File 'lib/encrypted_id.rb', line 51 def encrypted_id_default_key name end |
#find(*args) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/encrypted_id.rb', line 33 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
47 48 49 |
# File 'lib/encrypted_id.rb', line 47 def has_encrypted_id? true end |