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

Constant Summary

Constants included from Models::Schedulable

Models::Schedulable::SIMPLE_FORM_OPTIONS

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::Schedulable

config

Methods included from Models::AfterCommittable

#after_commit

Methods included from Models::EventPublishable

#publish_event

Instance Attribute Details

#nameObject (readonly)

attr_accessible :title, :body

Validations:



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

validates :name, presence: true

#screen_sizeInteger?

Returns Screen diagonal size in inches.

Returns:

  • (Integer, nil)

    Screen diagonal size in inches.



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

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

Class Method Details

.device_type_for_selectArray<String>

Returns:

  • (Array<String>)


42
43
44
# File 'app/models/it_asset.rb', line 42

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

Instance Method Details

#companyCompany

Returns:



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

belongs_to :company, optional: true

#employeeEmployee

Returns:



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

belongs_to :employee, optional: true