Class: Famili::Mother

Inherits:
GrandMother show all
Defined in:
lib/famili/mother.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GrandMother

#after_create, attributes, #before_save, #born, class_name, #father, field, has, inherited, #instantiate, lazy, method_missing, model_class, model_class=, name, parent_class, parent_class=, scope, scopes, trait

Class Method Details

.objects_sequence_numberObject



19
20
21
22
# File 'lib/famili/mother.rb', line 19

def objects_sequence_number
  @sequence_number ||= 0
  @sequence_number += 1
end

Instance Method Details

#save(model) ⇒ Object



6
7
8
# File 'lib/famili/mother.rb', line 6

def save(model)
  model.save!
end

#sequence_numberObject



14
15
16
# File 'lib/famili/mother.rb', line 14

def sequence_number
  @sequence_number ||= self.class.objects_sequence_number
end

#uniqueObject



10
11
12
# File 'lib/famili/mother.rb', line 10

def unique
  "#{"%10.6f" % Time.now.to_f}#{object_id.abs}"
end