Skip to content

Current ​

Request-scoped global context, built on ActiveSupport::CurrentAttributes and generated into app/models/current.rb.

Trek uses it for per-request data:

ruby
Current.session # the signed-in admin's User::Session, set by Trek::Authentication
Current.user    # its user (nil when signed out)
Current.icons   # the icons rendered on the page, for the icon sprite

trek:public_accounts adds its account's attributes, e.g. Current.customer. Extend it with your own request-scoped attributes as your application grows (tenant, locale…).

Released under the MIT License.