mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 23:42:04 +02:00
Added current_user for papertrail
This commit is contained in:
parent
aebe137978
commit
1591d6a7b4
5 changed files with 29 additions and 22 deletions
|
@ -1,15 +1,15 @@
|
|||
module Shared::UserStamper
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def stamp(obj)
|
||||
return false if obj.nil? || !obj.has_attribute?(:created_by_id && :updated_by_id)
|
||||
# def stamp(obj)
|
||||
# return false if obj.nil? || !obj.has_attribute?(:created_by_id && :updated_by_id)
|
||||
|
||||
if obj.new_record?
|
||||
obj.created_by_id = current_api_user.id
|
||||
else
|
||||
obj.updated_by_id = current_api_user.id
|
||||
end
|
||||
# if obj.new_record?
|
||||
# obj.created_by_id = current_api_user.id
|
||||
# else
|
||||
# obj.updated_by_id = current_api_user.id
|
||||
# end
|
||||
|
||||
true
|
||||
end
|
||||
# true
|
||||
# end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue