Rails already provides methods for creating class level and module level variables in the form of cattr** and mattr** suite of methods. In Rails 5, we can go a step further and create thread specific class or module level variables. Here is an example which demonstrates an example on how to use it. 1 2module CurrentScope 3 thread_mattr_accessor :user_permissions 4end 5 6class ApplicationController