[Git][noosfero/noosfero][master] return distinct elements in by_enterprise scope
Leandro Nunes
gitlab at mg.gitlab.com
Mon Dec 7 16:47:52 BRST 2015
Leandro Nunes pushed to branch master at Noosfero / noosfero
Commits:
3057b70b by Leandro Nunes dos Santos at 2015-12-07T15:45:31Z
return distinct elements in by_enterprise scope
- - - - -
1 changed file:
- app/models/product_category.rb
Changes:
=====================================
app/models/product_category.rb
=====================================
--- a/app/models/product_category.rb
+++ b/app/models/product_category.rb
@@ -7,7 +7,7 @@ class ProductCategory < Category
scope :unique, :select => 'DISTINCT ON (path) categories.*'
scope :by_enterprise, -> enterprise {
- joins(:products).
+ distinct.joins(:products).
where('products.profile_id = ?', enterprise.id)
}
scope :by_environment, -> environment {
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/3057b70bfe7e25e4dee80cae10c408238f040a02
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151207/6d35ca43/attachment.html>
More information about the Noosfero-dev
mailing list