Skip to content

Instantly share code, notes, and snippets.

@simonlehmann
Created February 17, 2017 08:39
Show Gist options
  • Save simonlehmann/47501cdea4c5119730405e81525b47f6 to your computer and use it in GitHub Desktop.
Save simonlehmann/47501cdea4c5119730405e81525b47f6 to your computer and use it in GitHub Desktop.
Loading all users with one of many Rolify roles per scoped resource
Class Forum < ActiveRecord::Base
belongs_to :user
def collaborators
User.with_any_role({ name: :admin, resource: self }, { name: :moderator, resource: self })
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment