Last active
August 29, 2015 14:22
-
-
Save rafaelcgo/e1bfdc54d96c34ee0e20 to your computer and use it in GitHub Desktop.
queries-users_from_activities_of_organization.rb
This file contains hidden or 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
Organization.first.activities.map(&:users) | |
User.where(id: Organization.first.activity_users.pluck(:user_id)) | |
User.includes(activity_users: {activities: :organizations}).where(organization_id: Organization.first) | |
User.includes(activity_users: {activity: :organization}).where(activities: {organization_id: Organization.first}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment