diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-04 20:23:31 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-04 20:23:31 +0400 |
commit | 181aa2b9160347ad23de3ef1e6f5ce45234261e1 (patch) | |
tree | 8983bbabf91a0bacb3016eb09936116961890688 | |
parent | 0cedd7039a882b67f1a94875f4e99de4c63b173b (diff) |
More efficient query for mentionable users
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | app/models/concerns/mentionable.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb index 5858fe1bb6f..a46a593c6e3 100644 --- a/app/models/concerns/mentionable.rb +++ b/app/models/concerns/mentionable.rb @@ -50,7 +50,7 @@ module Mentionable matches.each do |match| identifier = match.delete "@" if has_project - id = project.team.members.find { |u| u.username == identifier }.try(:id) + id = project.team.members.find_by(username: identifier).try(:id) else id = User.where(username: identifier).pluck(:id).first end |