Class: ItAsset

Inherits:
ApplicationRecord show all
Defined in:
app/models/it_asset.rb

Overview

== Schema Information

Table name: it_assets
Database name: primary

id :integer not null, primary key
description :text
device_type :string(255)
is_inactive :boolean
it_accessories :text
location :text
memory :string(255)
name :string(255)
notes :text
order_number :string(255)
phone_number :string(255)
processor :string(255)
screen_size :integer
serial_number :string(255)
software :string(255)
warranty_expiration_date :date
created_at :datetime not null
updated_at :datetime not null
company_id :integer
employee_id :integer
supplier_id :integer

Instance Attribute Summary collapse

Belongs to collapse

Class Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Instance Attribute Details

#screen_sizeObject (readonly)



31
# File 'app/models/it_asset.rb', line 31

validates :screen_size, :numericality => true, if: -> { screen_size.present? }

Class Method Details

.device_type_for_selectObject



36
37
38
# File 'app/models/it_asset.rb', line 36

def self.device_type_for_select
  %w[Laptop Desktop Phone Cell Tablet Mini Printer Monitor Peripheral Other]
end

Instance Method Details

#companyCompany

Returns:

See Also:



34
# File 'app/models/it_asset.rb', line 34

belongs_to :company, optional: true

#employeeEmployee

Returns:

See Also:



33
# File 'app/models/it_asset.rb', line 33

belongs_to :employee, optional: true