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.2.11 app/models/ecom/core/equipment.rb
ecom_core-1.2.10 app/models/ecom/core/equipment.rb
ecom_core-1.2.9 app/models/ecom/core/equipment.rb
ecom_core-1.2.7 app/models/ecom/core/equipment.rb
ecom_core-1.2.6 app/models/ecom/core/equipment.rb
ecom_core-1.2.5 app/models/ecom/core/equipment.rb
ecom_core-1.2.4 app/models/ecom/core/equipment.rb
ecom_core-1.2.3 app/models/ecom/core/equipment.rb
ecom_core-1.2.2 app/models/ecom/core/equipment.rb
ecom_core-1.2.1 app/models/ecom/core/equipment.rb
ecom_core-1.2.0 app/models/ecom/core/equipment.rb
ecom_core-1.1.28 app/models/ecom/core/equipment.rb
ecom_core-1.1.27 app/models/ecom/core/equipment.rb
ecom_core-1.1.26 app/models/ecom/core/equipment.rb
ecom_core-1.1.25 app/models/ecom/core/equipment.rb
ecom_core-1.1.24 app/models/ecom/core/equipment.rb
ecom_core-1.1.23 app/models/ecom/core/equipment.rb
ecom_core-1.1.22 app/models/ecom/core/equipment.rb
ecom_core-1.1.21 app/models/ecom/core/equipment.rb
ecom_core-1.1.20 app/models/ecom/core/equipment.rb