lib/tokenize.rb in jt-rails-tokenizable-1.2.0 vs lib/tokenize.rb in jt-rails-tokenizable-1.2.1
- old
+ new
@@ -47,6 +47,11 @@
random_token = only_digits ? format("%.#{size}d", SecureRandom.random_number(10**size)) : SecureRandom.hex(size)
break random_token unless self.class.exists?(field => random_token)
end
end
+ def generate_new_token!(field)
+ generate_new_token(field)
+ save!
+ end
+
end