Skip to content

Instantly share code, notes, and snippets.

@kennyp
Created March 10, 2014 15:07
Show Gist options
  • Save kennyp/9466742 to your computer and use it in GitHub Desktop.
Save kennyp/9466742 to your computer and use it in GitHub Desktop.
Users without a role.
Spree::User.joins('LEFT JOIN "spree_roles_users" ON "spree_roles_users"."user_id" = "spree_users"."id" LEFT JOIN "spree_roles" ON "spree_roles"."id" = "spree_roles_users"."role_id"').group('spree_users.id').having('count(spree_roles.id) = 0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment