Revision 89776bd5
Added by Ohad Levy over 11 years ago
- ID 89776bd51d82a1ca912e2f81984dbd58f8df9460
app/models/organization.rb | ||
---|---|---|
if user.admin?
|
||
conditions = { }
|
||
else
|
||
conditions = sanitize_sql_for_conditions([" (taxonomies.id in (?))", user.organizations.map(&:id)])
|
||
conditions = sanitize_sql_for_conditions([" (taxonomies.id in (?))", user.organization_ids])
|
||
end
|
||
where(conditions).reorder('type, name')
|
||
}
|
Also available in: Unified diff
Minor optimization
Since we are looking for the ID and the join table includes the ID
there is no reason to actaully fetch the data table it self.