summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorankonym <ankonym@gmail.com>2015-10-09 13:06:42 +0200
committerankonym <ankonym@gmail.com>2015-10-13 11:48:51 +0200
commitd38e6ab469630b8f4e72fa859e9aaac14c3033ff (patch)
tree22d924a5e35d35dc71f225c25a1c3017c3345929 /lib/tasks
parent847887f5ac86f8ea561f21739f683762761fe758 (diff)
Replace Coupon Code gem for invite code creation
Replacing the Coupon Code gem with base64/securerandom as suggested by Elijah.
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/invite_code.rake4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/tasks/invite_code.rake b/lib/tasks/invite_code.rake
index fa397bb..1654599 100644
--- a/lib/tasks/invite_code.rake
+++ b/lib/tasks/invite_code.rake
@@ -11,6 +11,10 @@ task :generate_invites, [:n, :u] => :environment do |task, args|
max_uses = args.u
end
+ def generate_invite
+ Base64.encode64(SecureRandom.random_bytes).downcase.gsub(/[0oil1+_\/]/,'')[0..7].scan(/..../).join('-')
+ end
+
codes.times do |x|
x = InviteCode.new
x.max_uses = max_uses