module Traka::IsTrakable::LocalInstanceMethods

Private Instance Methods

record_create() click to toggle source
# File lib/traka/is_trakable.rb, line 32
def record_create
  record_traka_change("create")
end
record_destroy() click to toggle source
# File lib/traka/is_trakable.rb, line 40
def record_destroy
  record_traka_change("destroy")
end
record_traka_change(action_type) click to toggle source
# File lib/traka/is_trakable.rb, line 44
def record_traka_change(action_type)
  Traka::Change.create(:klass => self.class.to_s,
                       :uuid => self.attributes[self.class.traka_uuid],
                       :action_type => action_type)
end
record_update() click to toggle source
# File lib/traka/is_trakable.rb, line 36
def record_update
  record_traka_change("update")
end
set_uuid() click to toggle source
# File lib/traka/is_trakable.rb, line 24
def set_uuid
  f = self.class.traka_uuid

  if self.attributes[f].blank?
    write_attribute(self.class.traka_uuid, SecureRandom.hex(20))
  end
end