rubyaustralia / melbourne-ruby

Organisers notes and processes
53 stars 5 forks source link

Requested Talk: How do `CurrentAttributes` work? #242

Open HashNotAdam opened 4 weeks ago

HashNotAdam commented 4 weeks ago

Description: Rails includes a class called ActiveSupport::CurrentAttributes that can be used to store values that relate only to the current request or job.

For example:

class Current < ActiveSupport::CurrentAttributes
  attribute :user
end

Current.user = User.first

How does Rails store these values? How can it ensure these values can only be read in the current request? What happens when you change the isolation level? From a practical standpoint, what does the isolation level mean?

Estimated Talk Time: 10–15 minutes

darkfishy commented 3 weeks ago

@HashNotAdam and @simran-sawhney I could talk about this in November, with proper presentation slides then 😅