Skip to content

Instantly share code, notes, and snippets.

@Schwad
Created February 19, 2018 14:45
Show Gist options
  • Save Schwad/307741b4de3065d80f9d7108c29f70f1 to your computer and use it in GitHub Desktop.
Save Schwad/307741b4de3065d80f9d7108c29f70f1 to your computer and use it in GitHub Desktop.
class Current < ActiveSupport::CurrentAttributes
attribute :account, :user
attribute :request_id, :user_agent, :ip_address
resets { Time.zone = nil }
def user=(user)
super
self.account = user.account
Time.zone = user.time_zone
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment