Added creator and updator

This commit is contained in:
Priit Tark 2015-01-29 17:58:24 +02:00
parent 52d662a8cb
commit 50673f6dda
5 changed files with 106 additions and 48 deletions

View file

@ -1,10 +1,22 @@
# Papertrail concerns is mainly tested at country spec
module Versions
extend ActiveSupport::Concern
included do
has_paper_trail class_name: "#{model_name}Version"
end
class_methods do
before_create :add_creator
before_create :add_updator
before_update :add_updator
def add_creator
self.creator_str = ::PaperTrail.whodunnit
true
end
def add_updator
self.updator_str = ::PaperTrail.whodunnit
true
end
end
end