lib/voltron/encryptable.rb in voltron-encrypt-0.1.3 vs lib/voltron/encryptable.rb in voltron-encrypt-0.1.4
- old
+ new
@@ -1,8 +1,12 @@
module Voltron
module Encryptable
+ def has_encrypted_id?
+ false
+ end
+
def encrypted_id
extend ClassMethods
include InstanceMethods
has_one :encryptable, as: :resource, class_name: "Voltron::Id"
@@ -11,17 +15,21 @@
self.build_encryptable id: find_id
end
end
module ClassMethods
+ def has_encrypted_id?
+ true
+ end
+
def find(*args)
scope = args.slice!(0)
options = args.slice!(0) || {}
if !options[:bypass] && ![:first, :last, :all].include?(scope.try(:to_sym))
scope = decoded_ids(scope)
end
-
+
super(scope)
end
def exists?(conditions = :none)
if conditions.is_a?(String)