diff options
author | Go MAEDA <maeda@farend.jp> | 2020-02-03 15:12:21 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-02-03 15:12:21 +0000 |
commit | 01f523f1658bdac92cfd2d1bfeb6999db2f23b46 (patch) | |
tree | 39756acff3e4b90c52afb3626cbf558b14740640 | |
parent | e9d5b0b8dc7f22a31b788ec99f585e46818ba7fe (diff) | |
download | redmine-01f523f1658bdac92cfd2d1bfeb6999db2f23b46.tar.gz redmine-01f523f1658bdac92cfd2d1bfeb6999db2f23b46.zip |
Rails 6: Fix deprecation warning "Class level methods will no longer inherit scoping" (#32911).
Patch by Pavel Rosický.
git-svn-id: http://svn.redmine.org/redmine/trunk@19490 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/user.rb | 4 | ||||
-rw-r--r-- | lib/redmine/acts/positioned.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index a837697a4..76f479bcd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -634,7 +634,7 @@ class User < Principal Project.unscoped do return @project_ids_by_role if @project_ids_by_role - group_class = anonymous? ? GroupAnonymous : GroupNonMember + group_class = anonymous? ? GroupAnonymous.unscoped : GroupNonMember.unscoped group_id = group_class.pluck(:id).first members = Member.joins(:project, :member_roles). @@ -970,7 +970,7 @@ class AnonymousUser < User def validate_anonymous_uniqueness # There should be only one AnonymousUser in the database - errors.add :base, 'An anonymous user already exists.' if AnonymousUser.exists? + errors.add :base, 'An anonymous user already exists.' if AnonymousUser.unscoped.exists? end def available_custom_fields diff --git a/lib/redmine/acts/positioned.rb b/lib/redmine/acts/positioned.rb index bb7f80524..f8134c6de 100644 --- a/lib/redmine/acts/positioned.rb +++ b/lib/redmine/acts/positioned.rb @@ -66,7 +66,7 @@ module Redmine h[column] = yield(column) h end - self.class.where(condition_hash) + self.class.unscoped.where(condition_hash) end def set_default_position |