Class: Toro::Database
- Inherits:
-
Object
- Object
- Toro::Database
- Defined in:
- lib/toro/database.rb
Constant Summary collapse
- SQL_DIRECTORY =
Pathname.new(File.('sql', File.dirname(__FILE__)))
Class Method Summary collapse
- .connection ⇒ Object
- .down ⇒ Object
- .query(sql, parameters = []) ⇒ Object
- .raw_connection ⇒ Object
- .up ⇒ Object
- .with_connection(&block) ⇒ Object
Class Method Details
.connection ⇒ Object
14 15 16 |
# File 'lib/toro/database.rb', line 14 def connection ActiveRecord::Base.connection end |
.down ⇒ Object
10 11 12 |
# File 'lib/toro/database.rb', line 10 def down execute_file('down') end |
.query(sql, parameters = []) ⇒ Object
22 23 24 |
# File 'lib/toro/database.rb', line 22 def query(sql, parameters=[]) raw_connection.exec(sql, parameters) end |
.raw_connection ⇒ Object
18 19 20 |
# File 'lib/toro/database.rb', line 18 def raw_connection connection.raw_connection end |
.up ⇒ Object
6 7 8 |
# File 'lib/toro/database.rb', line 6 def up execute_file('up') end |
.with_connection(&block) ⇒ Object
26 27 28 |
# File 'lib/toro/database.rb', line 26 def with_connection(&block) ActiveRecord::Base.connection_pool.with_connection(&block) end |