lib/seedy/records/users.rb in seedy-0.6.5 vs lib/seedy/records/users.rb in seedy-0.6.6
- old
+ new
@@ -24,22 +24,24 @@
:address_postalcode => :zip,
:employee_status => :status,
}
class << self
- def build
+ def build(offset)
user = Users.new
- user.update_attributes
+ user.update_attributes(offset)
user
end
end
- def update_attributes
- write_attribute(:user_name, set_user_name)
- write_attribute(:sugar_login, set_user_name)
+ def update_attributes(offset)
+ write_attribute(:user_name, set_user_name(offset))
+ write_attribute(:sugar_login, 0)
+ write_attribute(:user_hash, OpenSSL::Digest::MD5.new("#{offset}")) if offset
end
- def set_user_name
+ def set_user_name(offset)
+ return "user#{offset}" if offset
(@attributes[:first_name][0,1] + @attributes[:last_name][0,6]).downcase
end
end
end
\ No newline at end of file