Commit Graph

2 Commits

Author SHA1 Message Date
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
David Heinemeier Hansson
24a864437e ActiveSupport::CurrentAttributes provides a thread-isolated attributes singleton (#29180)
* Add ActiveSupport::CurrentAttributes to provide a thread-isolated attributes singleton

* Need to require first

* Move stubs into test namespace.

Thus they won't conflict with other Current and Person stubs.

* End of the line for you, whitespace!

* Support super in attribute methods.

Define instance level accessors in an included module such that
`super` in an overriden accessor works, akin to Active Model.

* Spare users the manual require.

Follow the example of concerns, autoload in the top level Active Support file.

* Add bidelegation support

* Rename #expose to #set. Simpler, clearer

* Automatically reset every instance.

Skips the need for users to actively embed something that resets
their CurrentAttributes instances.

* Fix test name; add tangible name value when blank.

* Try to ensure we run after a request as well.

* Delegate all missing methods to the instance

This allows regular `delegate` to serve, so we don't need bidelegate.

* Properly test resetting after execution cycle.

Also remove the stale puts debugging.

* Update documentation to match new autoreset
2017-05-26 20:00:27 +02:00