Class: Spree::TaxonBrandSelector
- Inherits:
-
Object
- Object
- Spree::TaxonBrandSelector
- Defined in:
- app/models/spree/taxon_brand_selector.rb
Constant Summary collapse
- BRANDS_TAXONOMY_NAME =
"Brands"
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(product) ⇒ TaxonBrandSelector
constructor
A new instance of TaxonBrandSelector.
Constructor Details
#initialize(product) ⇒ TaxonBrandSelector
Returns a new instance of TaxonBrandSelector.
7 8 9 |
# File 'app/models/spree/taxon_brand_selector.rb', line 7 def initialize(product) @product = product end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 |
# File 'app/models/spree/taxon_brand_selector.rb', line 11 def call product.taxons .joins(:taxonomy) .where(spree_taxonomies: { name: BRANDS_TAXONOMY_NAME }) .first end |