Class: Item::MapSpecToTemplate
- Inherits:
-
BaseService
- Object
- BaseService
- Item::MapSpecToTemplate
- Defined in:
- app/services/item/map_spec_to_template.rb
Instance Method Summary collapse
Methods inherited from BaseService
#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #options, #tagged_logger
Constructor Details
This class inherits a constructor from BaseService
Instance Method Details
#process ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/services/item/map_spec_to_template.rb', line 3 def process candidate_specs = [] ProductSpecification.where.not(item_id: nil).where.not(template: true).where(template_product_specification_id: nil).each do |ps| # Find all specs for this item which are template res = Item::SpecificationsRetriever.new.process(ps.item, { token: ps.token, template: true }) if res.specifications.present? && template_spec = res.specifications.first ps.update_column(:template_product_specification_id, template_spec.id) end end end |