Override the action log tag for a particular action. Should be set as early as possible in the request chain.
The user action log tag for requests made from this controller.
# File lib/openshift/controller/action_log.rb, line 68 def action_log_tag @action_log_tag ||= "#{action_log_tag_action}_#{action_log_tag_resource}" end
The tag for an action made from this controller method
# File lib/openshift/controller/action_log.rb, line 48 def action_log_tag_action case request.method when "GET" then params[:id] ? "SHOW" : "LIST" when "POST" then "ADD" when "PUT" then "UPDATE" when "DELETE" then "DELETE" else "UNKNOWN" end end
The resource that is being logged
# File lib/openshift/controller/action_log.rb, line 61 def action_log_tag_resource controller_name.singularize.upcase end
Log an action for the current user
# File lib/openshift/controller/action_log.rb, line 34 def log_action(*arguments) OpenShift::UserActionLog.action(*arguments) end
Log an action for a user who has not been authenticated yet. Will override any previous call to log_actions_as.
# File lib/openshift/controller/action_log.rb, line 27 def log_action_for(login, user_id, *arguments) OpenShift::UserActionLog.with_user(user_id, login) OpenShift::UserActionLog.action(*arguments) end
Log subsequent actions as the given user
# File lib/openshift/controller/action_log.rb, line 41 def log_actions_as(user) OpenShift::UserActionLog.with_user(user.id, user.login) end
# File lib/openshift/controller/action_log.rb, line 78 def set_logged_request OpenShift::UserActionLog.begin_request(request) yield ensure OpenShift::UserActionLog.end_request end