Skip to content

Instantly share code, notes, and snippets.

@rubytastic
Created September 27, 2011 23:43
Show Gist options
  • Save rubytastic/1246570 to your computer and use it in GitHub Desktop.
Save rubytastic/1246570 to your computer and use it in GitHub Desktop.
namespace :db do
desc("Create and insert shareable beta invtation codes")
task :populate => :environment do
# Create sharabe invitation codes
(1..100).each do |i|
ALPHABET = ('a'..'z').to_a
code = 8.times.map { ALPHABET.sample }.join
code = 8.times.inject('') { |s| s << ALPHABET.sample }
code = code.upcase
#puts code
# Save code to beta table
# set flag used=0
Beta.create!(:code => code,
:used => 0)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment