Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/fake/multitenancy/active_record/base.rb
Class Method Summary collapse
Class Method Details
.inherited(klass) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fake/multitenancy/active_record/base.rb', line 2 def self.inherited(klass) super return if klass.name.eql?('SchemaMigration') klass.class_eval do default_scope do if multitenant? where(tenant: Tenant.current.name) else scoped end end end end |