Add auto switch to default db for admin user

This commit is contained in:
Okechi Onyeje 2017-02-23 12:18:44 -05:00
parent 4783f37dcc
commit eab7216058

View File

@ -9,6 +9,8 @@ class User < ApplicationRecord
def after_database_authentication def after_database_authentication
if !self.admin if !self.admin
Apartment::Tenant.switch!(Company.find(self.company_id).company_name.gsub(/'/,'').gsub(/\s/,'')) Apartment::Tenant.switch!(Company.find(self.company_id).company_name.gsub(/'/,'').gsub(/\s/,''))
else
Apartment::Tenant.switch!
end end
end end
end end