lets not set NOT NULL fields to null…

This commit is contained in:
Jonne Hass 2011-12-11 04:12:58 +01:00
parent afb5e5e7f0
commit fe82cd6609
2 changed files with 12 additions and 1 deletions

View file

@ -151,6 +151,7 @@ class Profile < ActiveRecord::Base
clearable_fields.each do |field| clearable_fields.each do |field|
self[field] = nil self[field] = nil
end end
self[:searchable] = false
self.save self.save
end end

View file

@ -499,6 +499,12 @@ class User < ActiveRecord::Base
clearable_fields.each do |field| clearable_fields.each do |field|
self[field] = nil self[field] = nil
end end
[:getting_started,
:disable_mail,
:show_community_spotlight_in_stream].each do |field|
self[field] = false
end
self[:email] = "deletedaccount_#{self[:id]}@example.org"
random_password = ActiveSupport::SecureRandom.hex(20) random_password = ActiveSupport::SecureRandom.hex(20)
self.password = random_password self.password = random_password
@ -508,6 +514,10 @@ class User < ActiveRecord::Base
private private
def clearable_fields def clearable_fields
self.attributes.keys - ["id", "username", "encrypted_password", "created_at", "updated_at", "locked_at", "serialized_private_key"] self.attributes.keys - ["id", "username", "encrypted_password",
"created_at", "updated_at", "locked_at",
"serialized_private_key", "getting_started",
"disable_mail", "show_community_spotlight_in_stream",
"email"]
end end
end end