diff options
Diffstat (limited to 'app/models/customer_relations/contact.rb')
-rw-r--r-- | app/models/customer_relations/contact.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/customer_relations/contact.rb b/app/models/customer_relations/contact.rb index 5898bc3412f..d8669f1f4c2 100644 --- a/app/models/customer_relations/contact.rb +++ b/app/models/customer_relations/contact.rb @@ -25,6 +25,13 @@ class CustomerRelations::Contact < ApplicationRecord validates :description, length: { maximum: 1024 } validate :validate_email_format + def self.find_ids_by_emails(group_id, emails) + raise ArgumentError, "Cannot lookup more than #{MAX_PLUCK} emails" if emails.length > MAX_PLUCK + + where(group_id: group_id, email: emails) + .pluck(:id) + end + private def validate_email_format |