Skip to content

Instantly share code, notes, and snippets.

@oddlyfunctional
Created July 27, 2015 23:26
Show Gist options
  • Save oddlyfunctional/c8f2ea5558db18ced676 to your computer and use it in GitHub Desktop.
Save oddlyfunctional/c8f2ea5558db18ced676 to your computer and use it in GitHub Desktop.
sql = 'user_id = ? OR (client_id IN (?) AND (category_id IS NULL AND category_id IN (?) OR scenario_id IS NULL AND scenario_id IN (?)))'
Submission.where(sql, current_user.id, current_user.client_ids, current_user.categories.pluck(:id), current_user.scenarios.pluck(:id))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment