Commit 8b39ad223d4fe7592e2231c18d6a4c087f01286c
Committed by
Rodrigo Souto
1 parent
9969f2f8
Exists in
api_tasks
and in
3 other branches
Give the right certifiers list
Showing
1 changed file
with
6 additions
and
0 deletions
Show diff stats
app/models/qualifier.rb
... | ... | @@ -11,6 +11,12 @@ class Qualifier < ActiveRecord::Base |
11 | 11 | has_many :qualifier_certifiers, :dependent => :destroy |
12 | 12 | has_many :certifiers, :through => :qualifier_certifiers |
13 | 13 | |
14 | + def used_certs | |
15 | + Certifier.joins('INNER JOIN product_qualifiers' + | |
16 | + ' ON certifiers.id = product_qualifiers.certifier_id') | |
17 | + .where(product_qualifiers: {qualifier_id: self.id}) | |
18 | + end | |
19 | + | |
14 | 20 | has_many :product_qualifiers, :dependent => :destroy |
15 | 21 | has_many :products, :through => :product_qualifiers, :source => :product |
16 | 22 | ... | ... |