mirror of
https://github.com/oonyeje/Pearlception_Website_RoR.git
synced 2025-12-25 11:47:41 +00:00
Add auto switch to default db for admin user
This commit is contained in:
parent
4783f37dcc
commit
eab7216058
@ -9,6 +9,8 @@ class User < ApplicationRecord
|
||||
def after_database_authentication
|
||||
if !self.admin
|
||||
Apartment::Tenant.switch!(Company.find(self.company_id).company_name.gsub(/'/,'').gsub(/\s/,''))
|
||||
else
|
||||
Apartment::Tenant.switch!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user