Module: Voltron::Encryptable::ClassMethods
- Defined in:
- lib/voltron/encryptable.rb
Instance Method Summary collapse
- #delete(id) ⇒ Object
- #destroy(id) ⇒ Object
- #exists?(conditions = :none) ⇒ Boolean
- #find(*args) ⇒ Object
- #has_encrypted_id? ⇒ Boolean
Instance Method Details
#delete(id) ⇒ Object
47 48 49 |
# File 'lib/voltron/encryptable.rb', line 47 def delete(id) super(decoded_ids(id)) end |
#destroy(id) ⇒ Object
43 44 45 |
# File 'lib/voltron/encryptable.rb', line 43 def destroy(id) super(decoded_ids(id)) end |
#exists?(conditions = :none) ⇒ Boolean
33 34 35 36 37 38 39 40 41 |
# File 'lib/voltron/encryptable.rb', line 33 def exists?(conditions = :none) if conditions.is_a?(String) # If conditions is a string, assume it's an encoded id super(decoded_ids(conditions)) else # Otherwise do what exists? normally does super end end |
#find(*args) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/voltron/encryptable.rb', line 22 def find(*args) scope = args.slice!(0) = args.slice!(0) || {} if ![:bypass] && ![:first, :last, :all].include?(scope.try(:to_sym)) scope = decoded_ids(scope) end super(scope) end |
#has_encrypted_id? ⇒ Boolean
18 19 20 |
# File 'lib/voltron/encryptable.rb', line 18 def has_encrypted_id? true end |