Class: Ecom::Core::EquipmentItem

Inherits:
ApplicationRecord show all
Defined in:
app/models/ecom/core/equipment_item.rb

Constant Summary collapse

READY =
'Ready'
UNDER_MAINTENANCE =
'Under Maintenance'

Class Method Summary collapse

Class Method Details

.search(param) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'app/models/ecom/core/equipment_item.rb', line 13

def self.search(param)
  search_term = "%#{param.downcase}%"
  Ecom::Core::EquipmentItem
    .joins(:equipment)
    .where(
      'lower(ecom_core_equipment_items.name) LIKE ? OR lower(ecom_core_equipment.name) LIKE ?',
      search_term,
      search_term
    )
end