Class: Item Deprecated

Inherits:
ApplicationRecord show all
Extended by:
EventfulRecord
Includes:
EventfulRecord, Uuid::Uuidable
Defined in:
app/models/item.rb

Overview

Deprecated.

JG: As far as I am aware while these are still being generated in a few places they are no longer required and can probably be removed.

Legacy class which used to represent potential products before they had actually been created.

Constant Summary collapse

@@cached_requests =
nil

Instance Method Summary collapse

Methods included from EventfulRecord

has_many_events, has_many_lab_events, has_one_event_with_family

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#set_versionObject


30
31
32
33
34
35
36
37
# File 'app/models/item.rb', line 30

def set_version
  things_with_same_name = self.class.where(name: name)
  if things_with_same_name.empty?
    increment(:version)
  else
    self.version = things_with_same_name.size + 1
  end
end