I\'m pretty sure the error has nothing to do with the actual content of the TenantIdLoader module. Instead, it has something to do with ActiveSupport
TenantIdLoader
ActiveSupport
Changing ModuleName to ::ModuleName worked for me.