Skip to content

Instantly share code, notes, and snippets.

@jphenow
Created October 9, 2014 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jphenow/69d381b555d42887f254 to your computer and use it in GitHub Desktop.
Save jphenow/69d381b555d42887f254 to your computer and use it in GitHub Desktop.
uuid
# make IdExtractor partition the list sent in so you can get ids and uuids
scope :id_or_uuid, ->(id_or_uuid) {
extracted = IdExtractor.extract(id_or_uuid)
where(["#{table_name}.id IN (?) OR #{table_name}.uuid IN (?)", extracted.ids, extracted.uuids])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment