diff options
author | Francis Irving <francis@mysociety.org> | 2010-02-01 11:09:35 +0000 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-02-01 11:09:35 +0000 |
commit | 452ac41f05f655a9fd23c8df4796f26632c23050 (patch) | |
tree | a5939f233d181f2dbada83bb7e613b434ffb6884 /app/models/user.rb | |
parent | 908ea0cdad57053b73926afeb6cea7582e75e76d (diff) |
Basic form bits for profile photo (done on train over the weekend)
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index e0698a47f..bcad6229f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -275,7 +275,9 @@ class User < ActiveRecord::Base def set_profile_photo(new_profile_photo) ActiveRecord::Base.transaction do if !self.profile_photo.nil? - self.profile_photo.destroy + old_profile_photo = self.profile_photo + self.profile_photo = nil + old_profile_photo.destroy end new_profile_photo.user = self self.profile_photo = new_profile_photo |