fixed user seeds
This commit is contained in:
parent
31102ef86a
commit
3350d420d3
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue