Commit 3057b70bfe7e25e4dee80cae10c408238f040a02
1 parent
6ea50685
Exists in
master
and in
18 other branches
return distinct elements in by_enterprise scope
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
app/models/product_category.rb
... | ... | @@ -7,7 +7,7 @@ class ProductCategory < Category |
7 | 7 | |
8 | 8 | scope :unique, :select => 'DISTINCT ON (path) categories.*' |
9 | 9 | scope :by_enterprise, -> enterprise { |
10 | - joins(:products). | |
10 | + distinct.joins(:products). | |
11 | 11 | where('products.profile_id = ?', enterprise.id) |
12 | 12 | } |
13 | 13 | scope :by_environment, -> environment { | ... | ... |