Skip to content

Instantly share code, notes, and snippets.

@MSch
Last active January 2, 2016 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MSch/8280812 to your computer and use it in GitHub Desktop.
Save MSch/8280812 to your computer and use it in GitHub Desktop.
module ActiveRecord
class Connection
def connect
Thread.current.thread_variable_set(:connection_id, 123)
end
end
end
module Sequel
class Connection
def connect
Thread.current.thread_variable_set(:connection_id, 234)
end
end
end
# Both ActiveRecord and Sequel access the same connection_id thread local variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment