Commit d47334895b19a95aac72c8dddf70640beb8f4720
1 parent
c9c81cfa
Exists in
master
and in
20 other branches
Add memberships association for eager loading
Showing
1 changed file
with
3 additions
and
0 deletions
Show diff stats
app/models/person.rb
... | ... | @@ -67,6 +67,9 @@ class Person < Profile |
67 | 67 | end |
68 | 68 | alias_method_chain :has_permission?, :plugins |
69 | 69 | |
70 | + # for eager loading | |
71 | + has_many :memberships, through: :role_assignments, source: :resource, source_type: 'Profile' | |
72 | + | |
70 | 73 | def memberships |
71 | 74 | scopes = [] |
72 | 75 | plugins_scopes = plugins.dispatch_scopes(:person_memberships, self) | ... | ... |