Class: Multitenant::Mysql::Configs::Base
- Inherits:
-
Object
- Object
- Multitenant::Mysql::Configs::Base
- Defined in:
- lib/multitenant-mysql/configs/base.rb
Instance Attribute Summary collapse
-
#bucket ⇒ Object
Returns the value of attribute bucket.
-
#models ⇒ Object
Returns the value of attribute models.
Instance Method Summary collapse
- #bucket_field ⇒ Object
- #tenant ⇒ Object
- #tenant?(model) ⇒ Boolean
- #tenants_bucket(name) {|@bucket| ... } ⇒ Object
Instance Attribute Details
#bucket ⇒ Object
Returns the value of attribute bucket.
5 6 7 |
# File 'lib/multitenant-mysql/configs/base.rb', line 5 def bucket @bucket end |
#models ⇒ Object
Returns the value of attribute models.
5 6 7 |
# File 'lib/multitenant-mysql/configs/base.rb', line 5 def models @models end |
Instance Method Details
#bucket_field ⇒ Object
18 19 20 |
# File 'lib/multitenant-mysql/configs/base.rb', line 18 def bucket_field @bucket.field end |
#tenant ⇒ Object
14 15 16 |
# File 'lib/multitenant-mysql/configs/base.rb', line 14 def tenant @bucket.model end |
#tenant?(model) ⇒ Boolean
22 23 24 |
# File 'lib/multitenant-mysql/configs/base.rb', line 22 def tenant?(model) tenant == model end |
#tenants_bucket(name) {|@bucket| ... } ⇒ Object
7 8 9 10 11 12 |
# File 'lib/multitenant-mysql/configs/base.rb', line 7 def tenants_bucket(name) raise InvalidBucketError.new('Multitenant::Mysql: invalid bucket') if name.blank? @bucket = Bucket.new(name) yield(@bucket) if block_given? end |