Closed rusikf closed 4 years ago
on your application.rb
console do
if ENV["TENANT"]
Apartment::Tenant.switch!(ENV["TENANT"])
Rails.logger.info "Connected to tenant #{ENV["TENANT"]}"
end
end
Now you can do this: TENANT=name_of_tenant ./bin/rails c
Cool, Thanks for response! :+1:
Hi, now it is possible to switch tenant :
But I want run rails console in google ( I am to lazy to write every case Apartment::Tenant.switch ) Is it possible to setup specific ENV, so I can run rails s, bundle exec rake some_task in context of tenant ?( google in this example)