Class: Tenanfy::Tenant
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Tenanfy::Tenant
- Defined in:
- app/models/tenanfy/tenant.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find_by_domain(host) ⇒ Object
15 16 17 |
# File 'app/models/tenanfy/tenant.rb', line 15 def self.find_by_domain(host) self.filter_by_domain(host).first end |
Instance Method Details
#schema_name ⇒ Object
19 20 21 |
# File 'app/models/tenanfy/tenant.rb', line 19 def schema_name "tenant_#{id}" end |
#switch_to_tenant ⇒ Object
23 24 25 |
# File 'app/models/tenanfy/tenant.rb', line 23 def switch_to_tenant ::Apartment::Tenant.switch(schema_name) end |
#theme_paths ⇒ Object
27 28 29 30 31 |
# File 'app/models/tenanfy/tenant.rb', line 27 def theme_paths themes.map do |theme| "app/views/#{theme}" end end |