Class: Trainspotter::Record
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Trainspotter::Record
show all
- Defined in:
- app/models/trainspotter/record.rb
Constant Summary
collapse
- SCHEMA_VERSION =
4
Class Method Summary
collapse
Class Method Details
.ensure_connected ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/models/trainspotter/record.rb', line 8
def ensure_connected
return if @connected
establish_connection(
adapter: "sqlite3",
database: Trainspotter.database_path,
pool: 5,
timeout: 5000
)
ensure_schema
@connected = true
end
|
.reset_connection! ⇒ Object
21
22
23
24
25
26
27
|
# File 'app/models/trainspotter/record.rb', line 21
def reset_connection!
return unless @connected
connection_pool.disconnect!
connection_handler.remove_connection_pool(name) rescue nil
@connected = false
end
|