Added current_user for papertrail

This commit is contained in:
Priit Tark 2015-01-29 15:37:40 +02:00
parent aebe137978
commit 1591d6a7b4
5 changed files with 29 additions and 22 deletions

View file

@ -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