Module: Resta::Model::InstanceMethods

Defined in:
lib/resta/model.rb

Overview

Instance methods for model after been included.

Instance Method Summary collapse

Instance Method Details

#before_createObject



34
35
36
37
38
39
# File 'lib/resta/model.rb', line 34

def before_create
  return false if super == false
  update_version
  # generate a v4 random UUID for resource id unless use auto increase.
  self.id ||= SecureRandom.uuid unless self.class.use_increased_id
end

#before_updateObject



41
42
43
44
# File 'lib/resta/model.rb', line 41

def before_update
  return false if super == false
  update_version
end