diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-03 08:57:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-03 08:57:01 +0000 |
commit | 3e86a2ab52bcadea6ed92522a3d3e88b6dc4aa30 (patch) | |
tree | 36c336301429ef1eadd6d47e6031932b8a1a1a00 /app/models/user.rb | |
parent | e8c17ac6d71191040d757082cdb1fefe14f0e1c7 (diff) | |
download | redmine-3e86a2ab52bcadea6ed92522a3d3e88b6dc4aa30.tar.gz redmine-3e86a2ab52bcadea6ed92522a3d3e88b6dc4aa30.zip |
Use .unscoped when querying and creating builtin objects (#24156).
Patch by Holger Just.
git-svn-id: http://svn.redmine.org/redmine/trunk@16049 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 81a2e7c77..76b54c896 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -750,9 +750,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 |