summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorazul <azul@leap.se>2015-10-13 15:20:26 +0000
committerazul <azul@leap.se>2015-10-13 15:20:26 +0000
commitfd55d71cd1cbadcc5378601c0c9dfa6292bd4725 (patch)
treec36e96d7deb8191f7bc04c2d509e9f70c6de6754 /lib
parent70073b1ac48f96d3e375630fb7f3904351e0f696 (diff)
parentcb89699283aeb1ef4195a5c99d0319f3232f5db7 (diff)
Merge pull request #201 from Alster-Hamburgers/multi-invite
Allow multi-use invite codes
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/invite_code.rake17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/tasks/invite_code.rake b/lib/tasks/invite_code.rake
index f3bafac..d6e2b49 100644
--- a/lib/tasks/invite_code.rake
+++ b/lib/tasks/invite_code.rake
@@ -1,16 +1,21 @@
desc "Generate a batch of invite codes"
-task :generate_invites, [:n] => :environment do |task, args|
+task :generate_invites, [:n, :u] => :environment do |task, args|
- codes = args.n
- codes = codes.to_i
+ codes = args.n
+ codes = codes.to_i
- codes.times do |x|
+ if args.u != nil
+ max_uses = args.u
+ end
+
+ codes.times do |x|
x = InviteCode.new
+ x.max_uses = max_uses
x.save
- puts "#{x.invite_code} Code generated."
-
+ puts x.invite_code
end
+
end