lib/weasel/concerns/auditable.rb in weasel-0.2.1 vs lib/weasel/concerns/auditable.rb in weasel-0.2.2

- old
+ new

@@ -5,15 +5,23 @@ module Auditable def audit yield - user = current_user || current_admin + return unless user.present? Weasel::EventsWorker.perform_async(user.id, thin_request) end private + + def user + if defined?(current_user) + current_user + elsif defined?(current_admin) + current_admin + end + end def thin_request parameters = request.params rails_action = "#{parameters[:controller]}:#{parameters[:action]}"