Sha256: a504a3b8e697929a3dae10e4a0c3bc2c3044f19c11195953a6fc94f85f9a4021

Contents?: true

Size: 594 Bytes

Versions: 81

Compression:

Stored size: 594 Bytes

Contents

module Ecom
  module Core
    class Equipment < ApplicationRecord
      belongs_to :equipment_category

      validates :name, :minimum_acquisition_time, presence: true
      validates :name, uniqueness: { scope: :equipment_category_id }

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

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
ecom_core-1.3.14 app/models/ecom/core/equipment.rb
ecom_core-1.3.13 app/models/ecom/core/equipment.rb
ecom_core-1.3.12 app/models/ecom/core/equipment.rb
ecom_core-1.3.11 app/models/ecom/core/equipment.rb
ecom_core-1.3.10 app/models/ecom/core/equipment.rb
ecom_core-1.3.9 app/models/ecom/core/equipment.rb
ecom_core-1.3.8 app/models/ecom/core/equipment.rb
ecom_core-1.3.7 app/models/ecom/core/equipment.rb
ecom_core-1.3.6 app/models/ecom/core/equipment.rb
ecom_core-1.3.5 app/models/ecom/core/equipment.rb
ecom_core-1.3.4 app/models/ecom/core/equipment.rb
ecom_core-1.3.3 app/models/ecom/core/equipment.rb
ecom_core-1.3.2 app/models/ecom/core/equipment.rb
ecom_core-1.3.1 app/models/ecom/core/equipment.rb
ecom_core-1.3.0 app/models/ecom/core/equipment.rb
ecom_core-1.2.36 app/models/ecom/core/equipment.rb
ecom_core-1.2.35 app/models/ecom/core/equipment.rb
ecom_core-1.2.34 app/models/ecom/core/equipment.rb
ecom_core-1.2.33 app/models/ecom/core/equipment.rb
ecom_core-1.2.32 app/models/ecom/core/equipment.rb