Module: Index

Defined in:
lib/application/index.rb

Class Method Summary collapse

Class Method Details

.next_id(model = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/application/index.rb', line 4

def self.next_id(model = nil)
  return if model.nil?

  if $indexes.map(&:first).include?(model.class.name)
    $indexes[model.class.name] += 1
  else
    $indexes[model.class.name] = 1
  end
  $indexes[model.class.name]
end