Commit 12ea682b authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Fixed: NOT NULL constraint error when adding a group (#4632).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3343 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 8420f251
......@@ -32,6 +32,8 @@ class Principal < ActiveRecord::Base
}
}
before_create :set_default_empty_values
def <=>(principal)
if self.class.name == principal.class.name
self.to_s.downcase <=> principal.to_s.downcase
......@@ -40,4 +42,16 @@ class Principal < ActiveRecord::Base
principal.class.name <=> self.class.name
end
end
protected
# Make sure we don't try to insert NULL values (see #4632)
def set_default_empty_values
self.login ||= ''
self.hashed_password ||= ''
self.firstname ||= ''
self.lastname ||= ''
self.mail ||= ''
true
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment