Skip to content

Instantly share code, notes, and snippets.

@cheald
Created October 30, 2012 13:16
Show Gist options
  • Save cheald/3980118 to your computer and use it in GitHub Desktop.
Save cheald/3980118 to your computer and use it in GitHub Desktop.
@contacts = [{:email => "[email protected]", :name => "jordan"}]
all_emails = @contacts.map {|c| c[:email]}
existing = User.where("email in (?)", all_emails).select("email").all.map(&:email)
@contacts.reject! {|c| existing.include? c[:email] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment