FEATURE: phase 1 of supporting multiple email addresses

This commit is contained in:
Leo McArdle
2017-04-26 19:47:36 +01:00
committed by Guo Xiang Tan
parent 739794f0cb
commit d0b027d88d
35 changed files with 337 additions and 80 deletions

View File

@@ -12,7 +12,7 @@ class AvatarLookup
private
def self.lookup_columns
@lookup_columns ||= %i{id email username uploaded_avatar_id}
@lookup_columns ||= %i{id user_emails.email username uploaded_avatar_id}
end
def users
@@ -22,7 +22,8 @@ class AvatarLookup
def user_lookup_hash
# adding tap here is a personal taste thing
hash = {}
User.where(:id => @user_ids)
User.joins(:user_emails)
.where(id: @user_ids)
.select(AvatarLookup.lookup_columns)
.each{ |user| hash[user.id] = user }
hash