diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-20 08:59:58 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-20 08:59:58 +0000 |
commit | 61db44c211cd032a13ae21ed712150c4ff67a418 (patch) | |
tree | 767083c079a8daebed7db9a7d9868692a6b32a91 | |
parent | 98787ce42cd9b33c002afe6639eb1b9e0d016da7 (diff) | |
download | redmine-61db44c211cd032a13ae21ed712150c4ff67a418.tar.gz redmine-61db44c211cd032a13ae21ed712150c4ff67a418.zip |
Merged r16049 (#24156).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16094 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/group_builtin.rb | 4 | ||||
-rw-r--r-- | app/models/role.rb | 4 | ||||
-rw-r--r-- | app/models/user.rb | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/app/models/group_builtin.rb b/app/models/group_builtin.rb index 9cedb61df..29e1d8e2a 100644 --- a/app/models/group_builtin.rb +++ b/app/models/group_builtin.rb @@ -37,12 +37,12 @@ class GroupBuiltin < Group class << self def load_instance return nil if self == GroupBuiltin - instance = order('id').first || create_instance + instance = unscoped.order('id').first || create_instance end def create_instance raise 'The builtin group already exists.' if exists? - instance = new + instance = unscoped.new instance.lastname = name instance.save :validate => false raise 'Unable to create builtin group.' if instance.new_record? diff --git a/app/models/role.rb b/app/models/role.rb index b7d048e2a..f59c9bd5d 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -221,9 +221,9 @@ private end def self.find_or_create_system_role(builtin, name) - role = where(:builtin => builtin).first + role = unscoped.where(:builtin => builtin).first if role.nil? - role = create(:name => name, :position => 0) do |r| + role = unscoped.create(:name => name, :position => 0) do |r| r.builtin = builtin end raise "Unable to create the #{name} role." if role.new_record? diff --git a/app/models/user.rb b/app/models/user.rb index 65fb8abf9..b74180be0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -735,9 +735,9 @@ class User < Principal # Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only # one anonymous user per database. def self.anonymous - anonymous_user = AnonymousUser.first + anonymous_user = AnonymousUser.unscoped.first if anonymous_user.nil? - anonymous_user = AnonymousUser.create(:lastname => 'Anonymous', :firstname => '', :login => '', :status => 0) + anonymous_user = AnonymousUser.unscoped.create(:lastname => 'Anonymous', :firstname => '', :login => '', :status => 0) raise 'Unable to create the anonymous user.' if anonymous_user.new_record? end anonymous_user |