airblade/paper_trail — pull request #328 by dwbutler (2014-02-11 22:13:50+00:00)
Title: Thread safety for #without_versioning

This fixes https://github.com/airblade/paper_trail/issues/326 and https://github.com/airblade/paper_trail/issues/307.

The thread-local `paper_trail_store` is now used to track whether Paper Trail is enabled for a particular model. Note that this results in a small API change. `Model.paper_trail_enabled_for_model` is now set at runtime and doesn't change. (Changing the value of a `class_attribute` is not thread-safe; see https://github.com/airblade/paper_trail/issues/307). `PaperTrail.enabled_for_model?(Model)` is now the preferred way to query if Paper Trail is enabled. If not specified for the current thread, it falls back to querying `Model.paper_trail_enabled_for_model`.

I considered trying to leave the API unchanged, but it's very difficult to mimic all the behaviors of `class_attribute` without using `class_attribute`.

I would appreciate any feedback! I'm not sure how "public" the `Model.paper_trail_enabled_for_model` API is.