diff options
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/invite_code.rake | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/tasks/invite_code.rake b/lib/tasks/invite_code.rake index 3d608ce..d6e2b49 100644 --- a/lib/tasks/invite_code.rake +++ b/lib/tasks/invite_code.rake @@ -1,11 +1,18 @@ + + 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 + 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 end |