users: replace scopes with associations.

This commit is contained in:
evazion
2019-08-29 16:00:06 -05:00
parent 8756480500
commit 9a3e9747d8
14 changed files with 24 additions and 79 deletions

View File

@@ -138,14 +138,6 @@ class Dmail < ApplicationRecord
where("owner_id = ?", CurrentUser.id)
end
def to_name_matches(name)
where("to_id = (select _.id from users _ where lower(_.name) = ?)", name.mb_chars.downcase)
end
def from_name_matches(name)
where("from_id = (select _.id from users _ where lower(_.name) = ?)", name.mb_chars.downcase)
end
def search(params)
q = super