Sha256: d934bea98e73764c69d2359a6f9b9b2799785593914ee71c5ad801209ef6725c
Contents?: true
Size: 739 Bytes
Versions: 40
Compression:
Stored size: 739 Bytes
Contents
module Ecom module Core class EquipmentItem < ApplicationRecord READY = 'Ready' UNDER_MAINTENANCE = 'Under Maintenance' belongs_to :equipment belongs_to :current_location, class_name: 'Ecom::Core::EquipmentLocation' validates :name, :status, :serial_number, :purchase_date, :purchase_price, presence: true validates :serial_number, uniqueness: true 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 end end end
Version data entries
40 entries across 40 versions & 1 rubygems