fixed user seeds

This commit is contained in:
Alexey Nayden 2011-03-30 02:16:04 +04:00
parent 31102ef86a
commit 3350d420d3
2 changed files with 4 additions and 2 deletions

View File

@ -11,7 +11,9 @@ class User < ActiveRecord::Base
protected protected
def generate_password def generate_password
self.password = self.password_confirmation = Digest::MD5.hexdigest(Date.today.to_s)[0..6] if self.password.blank?
self.password = self.password_confirmation = Digest::MD5.hexdigest(Date.today.to_s)[0..6]
end
end end
def send_notification_email def send_notification_email

View File

@ -12,7 +12,7 @@ TEST_USERS.each do |tuser|
next if User.find_by_email(email) next if User.find_by_email(email)
name = tuser[1] name = tuser[1]
pass = Digest::MD5.hexdigest(name)[0..6] pass = Digest::MD5.hexdigest(name)[0..6]
User.create! :name => name, :email => email, :password => pass, :password_confirmation => pass user = User.create! :name => name, :email => email, :password => pass, :password_confirmation => pass
puts "Created user #{name} (#{email}) and password #{pass}" puts "Created user #{name} (#{email}) and password #{pass}"
end end