Class: Machina::Current

Inherits:
ActiveSupport::CurrentAttributes
  • Object
show all
Defined in:
lib/machina/current.rb

Overview

Thread-safe per-request store for the currently authenticated Authorized object.

The middleware writes exclusively to Machina::Current.authorized. Host apps that want ::Current.authorized should inherit from this class:

class Current < Machina::Current
  # add app-specific attributes here
end

Note: each CurrentAttributes subclass has independent thread-local storage, so ::Current.authorized and Machina::Current.authorized hold separate values even when ::Current < Machina::Current. The gem always reads and writes through Machina::Current.