refer to: http://snippets.aktagon.com/snippets/257-how-to-use-activerecord-without-rails
app.rb:
require 'active_record' require 'sqlite3' require 'logger' ActiveRecord::Base.logger = Logger.new('debug.log') configuration = YAML::load(IO.read('config/database.yml')) ActiveRecord::Base.establish_connection(configuration['development']) class User < ActiveRecord::Base end
database.yml:
development: adapter: sqlite3 database: db/data.sqlite3 pool: 5 timeout: 5000