def name
[ firstname, lastname].join(" ")
end
+
+ def email=(new_email)
+ self[:email] = new_email
+ end
# Authenticates a user by their login name and unencrypted password. Returns the user or nil.
def self.authenticate(login, password)
errors.add(:login, "should not begin or end with spaces") if login and login.strip!
errors.add(:login, "should contain only letters, numbers, and spaces") unless login =~ /^[A-Za-z0-9 ]*$/
end
+
end