1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
desc "Generate a batch of invite codes" task :generate_invites, [:n] => :environment do |task, args| codes = args.n codes = codes.to_i codes.times do |x| x = InviteCode.new x.save puts "#{x.invite_code} Code generated." end end