summaryrefslogtreecommitdiffstats
path: root/app/models/principal.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-10-06 16:03:26 +0000
committerGo MAEDA <maeda@farend.jp>2018-10-06 16:03:26 +0000
commite159928e6b81c02001411e7e886208533178c0ba (patch)
tree41c78911f17078c798e5fdc1362b7c18aff138d2 /app/models/principal.rb
parent323ef3182bc45184c7a14e3a8dc7244850baabed (diff)
downloadredmine-e159928e6b81c02001411e7e886208533178c0ba.tar.gz
redmine-e159928e6b81c02001411e7e886208533178c0ba.zip
Use find_by instead of where.first to remove unnecessary sorting (#26747).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@17586 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/principal.rb')
-rw-r--r--app/models/principal.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/principal.rb b/app/models/principal.rb
index aac4e6b0d..08926d3a1 100644
--- a/app/models/principal.rb
+++ b/app/models/principal.rb
@@ -132,7 +132,7 @@ class Principal < ActiveRecord::Base
end
def visible?(user=User.current)
- Principal.visible(user).where(:id => id).first == self
+ Principal.visible(user).find_by(:id => id) == self
end
# Returns true if the principal is a member of project