mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 09:45:11 +02:00
Added creator and updator
This commit is contained in:
parent
52d662a8cb
commit
50673f6dda
5 changed files with 106 additions and 48 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue