mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-02-21 20:20:34 +09:00
When it's set. Also, store it in current attributes for convenience. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
18 lines
312 B
Ruby
18 lines
312 B
Ruby
class Current < ActiveSupport::CurrentAttributes
|
|
attribute :session, :user, :request
|
|
|
|
delegate :host, :protocol, to: :request, prefix: true, allow_nil: true
|
|
|
|
def session=(value)
|
|
super(value)
|
|
|
|
if value.present?
|
|
self.user = session.user
|
|
end
|
|
end
|
|
|
|
def account
|
|
Account.first
|
|
end
|
|
end
|