Skip to content

Instantly share code, notes, and snippets.

@afcapel
Last active July 3, 2018 20:37
Show Gist options
  • Save afcapel/20facf8380ba2bee18a4afbd379dba56 to your computer and use it in GitHub Desktop.
Save afcapel/20facf8380ba2bee18a4afbd379dba56 to your computer and use it in GitHub Desktop.
# app/models/current.rb
class Current < ActiveSupport::CurrentAttributes
attribute :account, :person
def person=(person)
super
self.account = person&.account
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment