98755844a1
* Bind sessions to identities * Remove references to the identity token * Move email changes to identity * Move account menu into a turbo-frame * Create tenants from a tenanted route
16 lines
438 B
Ruby
16 lines
438 B
Ruby
class Current < ActiveSupport::CurrentAttributes
|
|
attribute :session, :membership
|
|
attribute :http_method, :request_id, :user_agent, :ip_address, :referrer
|
|
|
|
delegate :identity, to: :session, allow_nil: true
|
|
delegate :user, to: :membership, allow_nil: true
|
|
|
|
def session=(value)
|
|
super(value)
|
|
|
|
unless value.nil?
|
|
self.membership = identity.memberships.find_by(tenant: ApplicationRecord.current_tenant)
|
|
end
|
|
end
|
|
end
|