app/models/internal_id.rb
# Create a record in internal_ids if one does not yet exist
# and set its new_value if it is higher than the current last_value
#
# Note this will acquire a ROW SHARE lock on the InternalId record
Create a record in internal_ids if one does not yet exist
and set its new_value if it is higher than the current last_value

Note this will acquire a ROW SHARE lock on the InternalId record
Create a record in internal_ids if one does not yet exist and set its new_value if it is higher than the current last_value Note this will acquire a ROW SHARE lock on the InternalId record
def track_greatest(init, new_value)
      subject.transaction do
        (lookup || create_record(init)).track_greatest_and_save!(new_value)
      end
    end
def track_greatest ( init , new_value ) subject . transaction do ( lookup || create_record ( init ) ) . track_greatest_and_save! ( new_value ) end end
Create a record in internal_ids if one does not yet exist
and set its new_value if it is higher than the current last_value
Create a record in internal_ids if one does not yet exist and set its new_value if it is higher than the current last_value
init
<not_specific>
new_value
<not_specific>