Sha256: 21d091162f58de8fb3674e7e5ec5cbbba9dbbc47f8c4036f75e660132cba3ea1
Contents?: true
Size: 765 Bytes
Versions: 5
Compression:
Stored size: 765 Bytes
Contents
module Toro class Database SQL_DIRECTORY = Pathname.new(File.expand_path('sql', File.dirname(__FILE__))) class << self def up execute_file('up') end def down execute_file('down') end def connection ActiveRecord::Base.connection end def raw_connection connection.raw_connection end def query(sql, parameters=[]) raw_connection.exec(sql, parameters) end def with_connection(&block) ActiveRecord::Base.connection_pool.with_connection(&block) end private def execute_file(file_name) file_path = SQL_DIRECTORY.join("#{file_name}.sql") connection.execute(File.read(file_path)) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
toro-0.2.0 | lib/toro/database.rb |
toro-0.1.1 | lib/toro/database.rb |
toro-0.1.0 | lib/toro/database.rb |
toro-0.0.3 | lib/toro/database.rb |
toro-0.0.2 | lib/toro/database.rb |