Class: Apartment::Adapters::Sqlite3Adapter
- Inherits:
-
AbstractAdapter
- Object
- AbstractAdapter
- Apartment::Adapters::Sqlite3Adapter
- Defined in:
- lib/apartment/adapters/sqlite3_adapter.rb
Instance Attribute Summary
Attributes inherited from AbstractAdapter
Instance Method Summary collapse
- #current ⇒ Object
- #drop(tenant) ⇒ Object
-
#initialize(config) ⇒ Sqlite3Adapter
constructor
A new instance of Sqlite3Adapter.
Methods inherited from AbstractAdapter
#create, #each, #environmentify, #init, #process_excluded_models, #reset, #seed_data, #switch, #switch!
Constructor Details
#initialize(config) ⇒ Sqlite3Adapter
Returns a new instance of Sqlite3Adapter.
14 15 16 17 18 |
# File 'lib/apartment/adapters/sqlite3_adapter.rb', line 14 def initialize(config) @default_dir = File.(File.dirname(config[:database])) super end |
Instance Method Details
#current ⇒ Object
29 30 31 |
# File 'lib/apartment/adapters/sqlite3_adapter.rb', line 29 def current File.basename(Apartment.connection.instance_variable_get(:@config)[:database], '.sqlite3') end |
#drop(tenant) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/apartment/adapters/sqlite3_adapter.rb', line 20 def drop(tenant) unless File.exist?(database_file(tenant)) raise TenantNotFound, "The tenant #{environmentify(tenant)} cannot be found." end File.delete(database_file(tenant)) end |