Created
September 27, 2011 23:43
-
-
Save rubytastic/1246570 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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