Class: Item::Materials::CompatibleControlElectricalRoughInKits

Inherits:
BaseCompatibleFinder
  • Object
show all
Defined in:
app/services/item/materials/compatible_control_electrical_rough_in_kits.rb

Overview

This class is responsible for finding a catalog item's compatible rough in kits

Instance Method Summary collapse

Instance Method Details

#process(item:, catalog_items_scope: nil) ⇒ Object

At a minimum you need an item
If you provide a catalog item scope, such as Catalog.catalog_items.for_online_catalog
It will be used to populate the catalog_items results
Without a catalog item scope only the items will be populated in the result



8
9
10
11
12
13
14
15
16
17
18
# File 'app/services/item/materials/compatible_control_electrical_rough_in_kits.rb', line 8

def process(item:, catalog_items_scope: nil)
  items = Item.none
  catalog_items = CatalogItem.none
  messages = []
  if item.is_heating_element? && item.is_floor_heating_product? 
     items = Item.where(Item[:sku].matches("FHE-ROUGH-IN-KIT%"))
  end
  
  return_results(item: item, items: items, catalog_items_scope: catalog_items_scope)

end