module Resta::Model::InstanceMethods
Instance methods for model after been included.
Public Instance Methods
before_create()
click to toggle source
Calls superclass method
# 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_update()
click to toggle source
Calls superclass method
# File lib/resta/model.rb, line 41 def before_update return false if super == false update_version end
Private Instance Methods
update_version()
click to toggle source
# File lib/resta/model.rb, line 47 def update_version self[:'_$version'] = SecureRandom.hex(8) end