summaryrefslogtreecommitdiffstats
path: root/app/models/role.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-12-03 08:57:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-12-03 08:57:01 +0000
commit3e86a2ab52bcadea6ed92522a3d3e88b6dc4aa30 (patch)
tree36c336301429ef1eadd6d47e6031932b8a1a1a00 /app/models/role.rb
parente8c17ac6d71191040d757082cdb1fefe14f0e1c7 (diff)
downloadredmine-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/role.rb')
-rw-r--r--app/models/role.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/role.rb b/app/models/role.rb
index 8b4dbde86..b85d5a6b0 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -294,9 +294,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) do |r|
+ role = unscoped.create(:name => name) do |r|
r.builtin = builtin
end
raise "Unable to create the #{name} role (#{role.errors.full_messages.join(',')})." if role.new_record?