Class: Multitenant::Mysql::Configs::Bucket

Inherits:
Object
  • Object
show all
Defined in:
lib/multitenant-mysql/configs/bucket.rb

Constant Summary collapse

DEFAULT_TENANT_NAME_ATTR =
[:name, :title]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Bucket

Returns a new instance of Bucket.



8
9
10
# File 'lib/multitenant-mysql/configs/bucket.rb', line 8

def initialize(name)
  @name = name
end

Instance Attribute Details

#fieldObject

Returns the value of attribute field.



6
7
8
# File 'lib/multitenant-mysql/configs/bucket.rb', line 6

def field
  @field
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/multitenant-mysql/configs/bucket.rb', line 6

def name
  @name
end

Instance Method Details

#modelObject



12
13
14
15
16
17
18
19
20
# File 'lib/multitenant-mysql/configs/bucket.rb', line 12

def model
  @name.constantize
rescue
  if @name.blank?
    raise InvalidBucketError.new('Multitenant::Mysql: You should specify model which stores info about tenants.')
  else
    raise InvalidBucketError.new("Please check your multitenant-mysql configs. Seems like you are trying to use model which doesn't exist: #{@name}")
  end
end