Module: ProductLineUrls
- Defined in:
- app/constants/product_line_urls.rb
Overview
Stable lookup constants for product lines using slug_ltree paths.
These map to the slug_ltree column on the product_lines table —
an ltree built from the FriendlyId slug chain (e.g. "snow_melting.mat.powermat").
slug_ltree is unique per product line and supports fast ltree queries:
ProductLine.by_slug_ltree(path) — exact match
ProductLine.by_slug_ltree_descendants(path) — all descendants
ProductLine.by_slug_ltree_ancestors(path) — all ancestors
Usage in views:
<%= render Www::ProductCardsComponent.new(
product_line_slugs: [
ProductLineUrls::FLOOR_HEATING_TEMPZONE_FLEX_ROLL,
ProductLineUrls::FLOOR_HEATING_TEMPZONE_EASY_MAT
]
) %>
To verify all paths exist in database:
rails runner "ProductLineUrls.verify_all"
Constant Summary collapse
- FLOOR_HEATING =
===========================================================================
Floor Heating - TempZone (tile/stone) 'floor_heating'- FLOOR_HEATING_TEMPZONE =
Floor heating tempzone.
'floor_heating.tempzone'- FLOOR_HEATING_TEMPZONE_FLEX_ROLL =
Floor heating tempzone flex roll.
'floor_heating.tempzone.flex_roll'- FLOOR_HEATING_TEMPZONE_EASY_MAT =
Floor heating tempzone easy mat.
'floor_heating.tempzone.easy_mat'- FLOOR_HEATING_TEMPZONE_CABLE =
Floor heating tempzone cable.
'floor_heating.tempzone.cable'- FLOOR_HEATING_TEMPZONE_RULER_CABLE =
Floor heating tempzone ruler cable.
'floor_heating.tempzone.ruler_cable'- FLOOR_HEATING_TEMPZONE_CUSTOM_MAT =
Floor heating tempzone custom mat.
'floor_heating.tempzone.custom_mat'- FLOOR_HEATING_TEMPZONE_SHOWER_MAT_FLOOR =
Floor heating tempzone shower mat floor.
'floor_heating.tempzone.shower_mat.floor'- FLOOR_HEATING_TEMPZONE_SHOWER_MAT_BENCH =
Floor heating tempzone shower mat bench.
'floor_heating.tempzone.shower_mat.bench'- FLOOR_HEATING_TEMPZONE_INSTALLATION_KITS =
Floor heating tempzone installation kits.
'floor_heating.tempzone.installation_kits'- FLOOR_HEATING_TEMPZONE_CABLE_KITS_UNCOUPLING_NTRUST2 =
TempZone Cable Kits
'floor_heating.tempzone.cable.kits_with_uncoupling_membrane.ntrust2'- FLOOR_HEATING_TEMPZONE_CABLE_KITS_UNCOUPLING_NJOY =
Floor heating tempzone cable kits uncoupling njoy.
'floor_heating.tempzone.cable.kits_with_uncoupling_membrane.njoy'- FLOOR_HEATING_TEMPZONE_CABLE_KITS_FIXING_STRIPS_NTRUST2 =
Floor heating tempzone cable kits fixing strips ntrust2.
'floor_heating.tempzone.cable.kits_with_fixing_strips.ntrust2'- FLOOR_HEATING_TEMPZONE_CABLE_KITS_FIXING_STRIPS_NJOY =
Floor heating tempzone cable kits fixing strips njoy.
'floor_heating.tempzone.cable.kits_with_fixing_strips.njoy'- FLOOR_HEATING_TEMPZONE_FLEX_ROLL_TWIN_KITS_NTRUST2 =
TempZone Twin Conductor Kits
'floor_heating.tempzone.flex_roll.twin_conductor.kits.ntrust2'- FLOOR_HEATING_TEMPZONE_FLEX_ROLL_TWIN_KITS_NJOY =
Floor heating tempzone flex roll twin kits njoy.
'floor_heating.tempzone.flex_roll.twin_conductor.kits.njoy'- FLOOR_HEATING_TEMPZONE_EASY_MAT_TWIN_KITS_NTRUST2 =
Floor heating tempzone easy mat twin kits ntrust2.
'floor_heating.tempzone.easy_mat.twin_conductor.kits.ntrust2'- FLOOR_HEATING_TEMPZONE_EASY_MAT_TWIN_KITS_NJOY =
Floor heating tempzone easy mat twin kits njoy.
'floor_heating.tempzone.easy_mat.twin_conductor.kits.njoy'- FLOOR_HEATING_ENVIRON =
===========================================================================
Floor Heating - Environ (floating floors) 'floor_heating.environ'- FLOOR_HEATING_ENVIRON_FLEX_ROLL =
Floor heating environ flex roll.
'floor_heating.environ.flex_roll'- FLOOR_HEATING_SLAB_HEAT =
===========================================================================
Floor Heating - Slab Heat (concrete) 'floor_heating.slab_heat'- FLOOR_HEATING_SLAB_HEAT_MAT =
Floor heating slab heat mat.
'floor_heating.slab_heat.mat'- FLOOR_HEATING_SLAB_HEAT_CABLE =
Floor heating slab heat cable.
'floor_heating.slab_heat.cable'- FLOOR_HEATING_UNDERLAYMENT =
===========================================================================
Floor Heating - Underlayment & Controls 'floor_heating.underlayment'- FLOOR_HEATING_UNDERLAYMENT_THERMALSHEET =
Floor heating underlayment thermalsheet.
'floor_heating.underlayment.thermalsheet'- FLOOR_HEATING_UNDERLAYMENT_PRODESO =
Floor heating underlayment prodeso.
'floor_heating.underlayment.prodeso'- FLOOR_HEATING_CONTROL =
Floor heating control.
'floor_heating.control'- SNOW_MELTING =
===========================================================================
Snow Melting 'snow_melting'- SNOW_MELTING_MAT =
Snow melting mat.
'snow_melting.mat'- SNOW_MELTING_POWERMAT =
Snow melting powermat.
'snow_melting.mat.powermat'- SNOW_MELTING_OMNIMAT =
Snow melting omnimat.
'snow_melting.mat.omnimat'- SNOW_MELTING_ECOMAT =
Snow melting ecomat.
'snow_melting.mat.ecomat'- SNOW_MELTING_CABLE =
Snow melting cable.
'snow_melting.cable'- SNOW_MELTING_CONTROL =
Snow melting control.
'snow_melting.control'- ROOF_GUTTER_DEICING =
===========================================================================
Roof & Gutter Deicing 'roof_and_gutter_deicing'- ROOF_GUTTER_DEICING_SELF_REGULATING =
Roof gutter deicing self regulating.
'roof_and_gutter_deicing.self_regulating_cut_to_length_cable'- ROOF_GUTTER_DEICING_CONSTANT_WATTAGE =
Roof gutter deicing constant wattage.
'roof_and_gutter_deicing.constant_wattage.pre_assembled_plug_in_kits'- ROOF_GUTTER_DEICING_CONTROL =
Roof gutter deicing control.
'roof_and_gutter_deicing.self_regulating_cut_to_length_cable.control'- PIPE_FREEZE_PROTECTION =
===========================================================================
Pipe Freeze Protection 'pipe_freeze_protection'- PIPE_FREEZE_PROTECTION_SELF_REGULATING =
Pipe freeze protection self regulating.
'pipe_freeze_protection.self_regulating_cable'- PIPE_FREEZE_PROTECTION_CONSTANT_WATTAGE =
Pipe freeze protection constant wattage.
'pipe_freeze_protection.constant_wattage_cable'- PIPE_FREEZE_PROTECTION_CONTROL =
Pipe freeze protection control.
'pipe_freeze_protection.self_regulating_cable.pipe_freeze_control'- TOWEL_WARMER =
===========================================================================
Towel Warmers 'towel_warmer'- TOWEL_WARMER_CLASSIC =
Towel warmer classic.
'towel_warmer.classic'- TOWEL_WARMER_COSMOPOLITAN =
Towel warmer cosmopolitan.
'towel_warmer.cosmopolitan'- TOWEL_WARMER_CONTROL =
Towel warmer control.
'towel_warmer.control'- TOWEL_WARMER_CRYSTAL_ACCESSORIES =
Towel warmer crystal accessories.
'towel_warmer.crystal_accessories'- INFRARED_HEATING_PANELS =
===========================================================================
Infrared Heating Panels 'infrared_heating_panels'- INFRARED_HEATING_PANELS_LAVA =
Infrared heating panel lava.
'infrared_heating_panels.lava'- INFRARED_HEATING_PANELS_EMBER =
Infrared heating panel ember.
'infrared_heating_panels.ember'- INFRARED_HEATING_PANELS_EMBER_GLASS =
Infrared heating panel ember glass.
'infrared_heating_panels.ember.glass'- INFRARED_HEATING_PANELS_EMBER_MIRROR =
Infrared heating panel ember mirror.
'infrared_heating_panels.ember.mirror'- INFRARED_HEATING_PANELS_EMBER_FLEX =
Infrared heating panel ember flex.
'infrared_heating_panels.ember.flex'- INFRARED_HEATING_PANELS_CONTROL =
Infrared heating panel control.
'infrared_heating_panels.control'- LED_MIRROR =
===========================================================================
LED Mirrors & Defoggers 'led_mirror'- MIRROR_DEFOGGER =
Mirror defogger.
'mirror_defogger'- COUNTERTOP_HEATER =
===========================================================================
Countertop Heaters 'countertop_heater'- COUNTERTOP_HEATER_STANDARD =
Countertop heater standard.
'countertop_heater.standard'- COUNTERTOP_HEATER_CONTROL =
Countertop heater control.
'countertop_heater.control'- SERVICES_SMARTFIT =
===========================================================================
Services 'services.smartfit'- SERVICES_SMARTINSTALL =
Services smartinstall.
'services.smartinstall'- SERVICES_SMARTFIX =
Services smartfix.
'services.smartfix'- SERVICES_SMARTGUIDE =
Services smartguide.
'services.smartguide'- FLOOR_HEATING_TEMPZONE_MATS =
TempZone mats & rolls (tile/stone)
[ FLOOR_HEATING_TEMPZONE_FLEX_ROLL, FLOOR_HEATING_TEMPZONE_EASY_MAT, FLOOR_HEATING_TEMPZONE_CUSTOM_MAT ].freeze
- FLOOR_HEATING_TEMPZONE_CABLES =
TempZone cables
[ FLOOR_HEATING_TEMPZONE_CABLE, FLOOR_HEATING_TEMPZONE_RULER_CABLE ].freeze
- FLOOR_HEATING_ENVIRON_PRODUCTS =
Environ products (floating floors)
[ FLOOR_HEATING_ENVIRON_FLEX_ROLL ].freeze
- FLOOR_HEATING_SLAB_HEAT_PRODUCTS =
Slab Heat products (concrete)
[ FLOOR_HEATING_SLAB_HEAT_MAT, FLOOR_HEATING_SLAB_HEAT_CABLE ].freeze
- FLOOR_HEATING_SHOWER_PRODUCTS =
Shower heating products
[ FLOOR_HEATING_TEMPZONE_SHOWER_MAT_FLOOR, FLOOR_HEATING_TEMPZONE_SHOWER_MAT_BENCH ].freeze
- FLOOR_HEATING_PRODUCTS =
All floor heating product options (for landing pages)
[ FLOOR_HEATING_TEMPZONE_FLEX_ROLL, FLOOR_HEATING_TEMPZONE_EASY_MAT, FLOOR_HEATING_TEMPZONE_CABLE, FLOOR_HEATING_TEMPZONE_CUSTOM_MAT, FLOOR_HEATING_ENVIRON_FLEX_ROLL, FLOOR_HEATING_SLAB_HEAT_MAT, FLOOR_HEATING_SLAB_HEAT_CABLE ].freeze
- SNOW_MELTING_PRODUCTS =
Snow melting products (using individual mat types instead of parent)
Note: EcoMat excluded - special order only, not publicly available [ SNOW_MELTING_POWERMAT, SNOW_MELTING_OMNIMAT, SNOW_MELTING_CABLE ].freeze
- ROOF_GUTTER_DEICING_PRODUCTS =
Roof & gutter deicing products
[ ROOF_GUTTER_DEICING_SELF_REGULATING, ROOF_GUTTER_DEICING_CONSTANT_WATTAGE ].freeze
- PIPE_FREEZE_PROTECTION_PRODUCTS =
Pipe freeze protection products
[ PIPE_FREEZE_PROTECTION_SELF_REGULATING, PIPE_FREEZE_PROTECTION_CONSTANT_WATTAGE ].freeze
- INFRARED_HEATING_PANELS_EMBER_PRODUCTS =
Infrared heating panel ember products
[ INFRARED_HEATING_PANELS_EMBER_GLASS, INFRARED_HEATING_PANELS_EMBER_MIRROR, INFRARED_HEATING_PANELS_EMBER_FLEX ].freeze
- ALL_CONTROLS =
All control product lines
[ FLOOR_HEATING_CONTROL, SNOW_MELTING_CONTROL, ROOF_GUTTER_DEICING_CONTROL, PIPE_FREEZE_PROTECTION_CONTROL, INFRARED_HEATING_PANELS_CONTROL, TOWEL_WARMER_CONTROL, COUNTERTOP_HEATER_CONTROL ].freeze
Class Method Summary collapse
-
.all_paths ⇒ Object
=========================================================================== Verification ===========================================================================.
- .suggest_missing ⇒ Object
- .verify_all ⇒ Object
Class Method Details
.all_paths ⇒ Object
===========================================================================
Verification
275 276 277 278 279 |
# File 'app/constants/product_line_urls.rb', line 275 def self.all_paths constants.map { |c| const_get(c) } .grep(String) .uniq end |
.suggest_missing ⇒ Object
305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'app/constants/product_line_urls.rb', line 305 def self.suggest_missing existing = all_paths.to_set db_paths = ProductLine.where.not(inactive: true).pluck(:slug_ltree).compact.map(&:to_s) missing = db_paths - existing.to_a if missing.empty? puts 'All active product line slug_ltree paths are defined as constants' else puts "#{missing.size} product line paths not yet defined as constants:" missing.sort.each { |p| puts " #{p}" } end end |
.verify_all ⇒ Object
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'app/constants/product_line_urls.rb', line 281 def self.verify_all errors = [] found = 0 all_paths.each do |path| pl = ProductLine.find_by(slug_ltree: path) if pl.nil? errors << "ProductLine with slug_ltree='#{path}' not found" else found += 1 end end if errors.empty? puts "All #{found} product line paths verified!" true else puts "#{found} paths found" puts "#{errors.size} errors:" errors.each { |e| puts " - #{e}" } false end end |