Module: InternalId

Extended by:
ActiveSupport::Concern
Included in:
Issue, MergeRequest, Milestone
Defined in:
app/models/concerns/internal_id.rb

Instance Method Summary collapse

Instance Method Details

#set_iidObject


9
10
11
12
13
14
15
16
17
# File 'app/models/concerns/internal_id.rb', line 9

def set_iid
  if iid.blank?
    records = project.send(self.class.name.tableize)
    records = records.with_deleted if self.paranoid?
    max_iid = records.maximum(:iid)

    self.iid = max_iid.to_i + 1
  end
end

#to_paramObject


19
20
21
# File 'app/models/concerns/internal_id.rb', line 19

def to_param
  iid.to_s
end