Sha256: 4cf8aa3e3d0e7db2d3528a72d9564d3571692e58bd3883cb0b95c0eeee5873b3
Contents?: true
Size: 544 Bytes
Versions: 1
Compression:
Stored size: 544 Bytes
Contents
# frozen_string_literal: true module LoggableActivity # Stores current user in a thread variable so is can be accessed from the LoggableActivity::Hook model module CurrentActor extend ActiveSupport::Concern included do before_action :set_current_actor after_action :clear_current_actor end private def set_current_actor return unless current_user Thread.current[:current_actor] = current_user end def clear_current_actor Thread.current[:current_actor] = nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
loggable_activity-0.5.7 | lib/loggable_activity/concerns/current_actor.rb |