diff options
-rw-r--r-- | app/models/group_builtin.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/group_builtin.rb b/app/models/group_builtin.rb index 1054d9d86..90fb3424b 100644 --- a/app/models/group_builtin.rb +++ b/app/models/group_builtin.rb @@ -39,15 +39,18 @@ class GroupBuiltin < Group class << self def load_instance return nil if self == GroupBuiltin + instance = unscoped.order('id').first || create_instance end def create_instance raise 'The builtin group already exists.' if exists? + instance = unscoped.new instance.lastname = name instance.save :validate => false raise 'Unable to create builtin group.' if instance.new_record? + instance end private :create_instance |