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.1.19 app/models/ecom/core/equipment.rb
ecom_core-1.1.18 app/models/ecom/core/equipment.rb
ecom_core-1.1.17 app/models/ecom/core/equipment.rb
ecom_core-1.1.16 app/models/ecom/core/equipment.rb
ecom_core-1.1.15 app/models/ecom/core/equipment.rb
ecom_core-1.1.14 app/models/ecom/core/equipment.rb
ecom_core-1.1.13 app/models/ecom/core/equipment.rb
ecom_core-1.1.12 app/models/ecom/core/equipment.rb
ecom_core-1.1.11 app/models/ecom/core/equipment.rb
ecom_core-1.1.10 app/models/ecom/core/equipment.rb
ecom_core-1.1.9 app/models/ecom/core/equipment.rb
ecom_core-1.1.8 app/models/ecom/core/equipment.rb
ecom_core-1.1.7 app/models/ecom/core/equipment.rb
ecom_core-1.1.6 app/models/ecom/core/equipment.rb
ecom_core-1.1.5 app/models/ecom/core/equipment.rb
ecom_core-1.1.4 app/models/ecom/core/equipment.rb
ecom_core-1.1.3 app/models/ecom/core/equipment.rb
ecom_core-1.1.2 app/models/ecom/core/equipment.rb
ecom_core-1.1.1 app/models/ecom/core/equipment.rb
ecom_core-1.1.0 app/models/ecom/core/equipment.rb