Class: Specify::Model::RecordSet

Inherits:
Object
  • Object
show all
Defined in:
lib/specify/models/record_set.rb

Overview

Sequel::Model for Collection Object record sets (only!).

Instance Method Summary collapse

Instance Method Details

#before_createObject



26
27
28
29
30
31
32
# File 'lib/specify/models/record_set.rb', line 26

def before_create
  self.Version = 0
  self.TimestampCreated = Time.now
  self.TableID = 1 # For CollectionObject record sets
  self.Type = 0    # FIXME: guess
  super
end

#before_updateObject



34
35
36
37
38
# File 'lib/specify/models/record_set.rb', line 34

def before_update
  self.Version += 1
  self.TimestampModified = Time.now
  super
end

#highest_order_numberObject



40
41
42
# File 'lib/specify/models/record_set.rb', line 40

def highest_order_number
  record_set_items_dataset.max(:OrderNumber)
end

#next_order_numberObject



44
45
46
47
# File 'lib/specify/models/record_set.rb', line 44

def next_order_number
  return 0 unless highest_order_number
  highest_order_number + 1
end