Commit 3057b70bfe7e25e4dee80cae10c408238f040a02

Authored by Leandro Santos
1 parent 6ea50685

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 +7,7 @@ class ProductCategory < Category
7 7
8 scope :unique, :select => 'DISTINCT ON (path) categories.*' 8 scope :unique, :select => 'DISTINCT ON (path) categories.*'
9 scope :by_enterprise, -> enterprise { 9 scope :by_enterprise, -> enterprise {
10 - joins(:products). 10 + distinct.joins(:products).
11 where('products.profile_id = ?', enterprise.id) 11 where('products.profile_id = ?', enterprise.id)
12 } 12 }
13 scope :by_environment, -> environment { 13 scope :by_environment, -> environment {