Last active
October 3, 2018 16:24
-
-
Save brunopgalvao/e2653316f09b150e74249b7fd8d267cd to your computer and use it in GitHub Desktop.
account dups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_for_existing_membership | |
accounts = Account.where(email_address: email) | |
accounts.each do |account| | |
if account.portals.pluck(:id) == portal.id | |
errors.add(:duplicate, 'The email is already associated with members of this organization') | |
return false | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment