Rails5でActiveSupport::PerThreadRegistryがdeprecatedになったよヘ(^o^)ノ

ちょっと今更ですが、Rails5でActiveSupport::PerThreadRegistryがdeprecatedになった。

ActiveSupport::PerThreadRegistryを使ったほうがイイ理由は遠い昔に書いたブログを参照してね。 murajun1978.hatenadiary.com

ActiveSupport::PerThreadRegistryにも書いてある、、

NOTE: This approach has been deprecated for end-user code in favor of thread_mattr_accessor and friends. Please use that approach instead.

thread_mattr_accessor を使えと

# ActiveSupport::PerThreadRegistry
class RuntimeRegistry
  extend ActiveSupport::PerThreadRegistry

  attr_accessor :api_runtime
end

# thread_mattr_accessor
class RuntimeRegistry
  thread_mattr_accessor :api_runtime
end

シンプルでいい感じヽ(´▽`)/

こういうのは都度対応しておかないと、バージョンアップの時にツラくなるのでサッと修正した方がいいね。

Happy Hacking٩( ‘ω’ )و