Version refactored

This commit is contained in:
Priit Tark 2015-01-30 23:25:46 +02:00
parent c1949e7069
commit 3e2be53853
48 changed files with 379 additions and 147 deletions

View file

@ -16,13 +16,23 @@ class ApplicationController < ActionController::Base
def user_for_paper_trail
if defined?(current_api_user) && current_api_user.present?
"#{current_api_user.id}-api-#{current_api_user.username}"
# Most of the time it's not loaded in correct time because PaperTrail before filter kicks in
# before current_api_user is defined. PaperTrail is triggered also at current_api_user
api_user_log_str(current_api_user)
elsif current_user.present?
"#{current_user.id}-#{current_user.username}"
else
'public'
end
end
def api_user_log_str(user)
if user.present?
"#{user.id}-api-#{user.username}"
else
'api-public'
end
end
end
class ApplicationController < ActionController::Base