Class: Apartment::Adapters::Sqlite3Adapter
Instance Attribute Summary
#default_tenant
Instance Method Summary
collapse
#create, #current_database, #current_tenant, #each, #process, #process_excluded_models, #reset, #seed_data, #switch, #switch!
Constructor Details
12
13
14
15
16
|
# File 'lib/apartment/adapters/sqlite3_adapter.rb', line 12
def initialize(config)
@default_dir = File.expand_path(File.dirname(config[:database]))
super
end
|
Instance Method Details
#current ⇒ Object
25
26
27
|
# File 'lib/apartment/adapters/sqlite3_adapter.rb', line 25
def current
File.basename(Apartment.connection.instance_variable_get(:@config)[:database], '.sqlite3')
end
|
#drop(tenant) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/apartment/adapters/sqlite3_adapter.rb', line 18
def drop(tenant)
raise TenantNotFound,
"The tenant #{environmentify(tenant)} cannot be found." unless File.exists?(database_file(tenant))
File.delete(database_file(tenant))
end
|