Skip to content

Commit

Permalink
update by external identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiomagalhaes committed Nov 20, 2023
1 parent 77ceb65 commit 0cbf159
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ def name
end

scope :by_external_identifier, lambda { |identifiers|
identifiers = [identifiers].flatten.compact.map(&:downcase)
joins('LEFT JOIN user_service_identifiers ON users.id = user_service_identifiers.user_id')
.where('users.email IN (:identifiers) OR user_service_identifiers.identifier IN (:identifiers)', identifiers:)
.where('lower(users.email) IN (:identifiers) OR lower(user_service_identifiers.identifier) IN (:identifiers)',
identifiers:)
}

def should_generate_new_friendly_id?
Expand Down

0 comments on commit 0cbf159

Please sign in to comment.