Class: Specify::Model::RecordSet
- Inherits:
-
Object
- Object
- Specify::Model::RecordSet
- Includes:
- Createable, Updateable
- Defined in:
- lib/specify/models/record_set.rb
Overview
RecordSets are groups of records of certain classes in the Specify::Model, for example Specify::Model::CollectionObject (currently the only supported class for record sets).
A RecordSet ontains Specify::Model::RecordSetItem instances. The items are ordered in the RecordSet, and the order is determined bu the Specify::Model::RecordSetItem#order_number.
Instance Method Summary collapse
-
#before_create ⇒ Object
Sequel hook that sets the TableID that determines the kind of record set (currently, only record sets of Specify::Model::CollectionObject instances are supported - TableID =
1). -
#highest_order_number ⇒ Object
Returns the highest order number of items in
self. -
#next_order_number ⇒ Object
Returns the order number for the next item added to
self.
Methods included from Updateable
Instance Method Details
#before_create ⇒ Object
Sequel hook that sets the TableID that determines the kind of record set (currently, only record sets of Specify::Model::CollectionObject instances are supported - TableID = 1). Also sets the Type.
37 38 39 40 41 |
# File 'lib/specify/models/record_set.rb', line 37 def before_create self[:TableID] = 1 self[:Type] = 0 # FIXME: guess super end |
#highest_order_number ⇒ Object
Returns the highest order number of items in self.
44 45 46 |
# File 'lib/specify/models/record_set.rb', line 44 def highest_order_number record_set_items_dataset.max(:OrderNumber) end |
#next_order_number ⇒ Object
Returns the order number for the next item added to self
49 50 51 52 |
# File 'lib/specify/models/record_set.rb', line 49 def next_order_number return 0 unless highest_order_number highest_order_number + 1 end |