diff options
author | francis <francis> | 2008-04-15 12:06:59 +0000 |
---|---|---|
committer | francis <francis> | 2008-04-15 12:06:59 +0000 |
commit | 589d4a2a829205a6262cdf7e85881a6a1a2a6fb8 (patch) | |
tree | 5b4d6f10f0ffceb7ebd751c6112807cadcaea599 | |
parent | 02fafd5578ff3940e8c6b75f55dadeb7f3691298 (diff) |
Cope with nil
-rw-r--r-- | app/models/user.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 06d36bdba..540dcb648 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user.rb,v 1.48 2008-04-15 12:01:19 francis Exp $ +# $Id: user.rb,v 1.49 2008-04-15 12:06:59 francis Exp $ require 'digest/sha1' @@ -56,7 +56,11 @@ class User < ActiveRecord::Base # Don't display any leading/trailing spaces def name - read_attribute(:name).strip + name = read_attribute(:name) + if not name.nil? + name.strip! + end + name end # Return user given login email, password and other form parameters (e.g. name) |