Skip to content

Instantly share code, notes, and snippets.

@amolbrid
Created November 22, 2010 02:36
Show Gist options
  • Save amolbrid/709442 to your computer and use it in GitHub Desktop.
Save amolbrid/709442 to your computer and use it in GitHub Desktop.
Using ActiveRecord without Rails
require 'rubygems'
require 'active_record'
dbconfig = YAML::load(File.open('database.yml'))
ActiveRecord::Base.establish_connection(dbconfig)
ActiveRecord::Base.logger = Logger.new(File.open('database.log', 'a'))
class Employee < ActiveRecord::Base
end
emp = Employee.find(1)
p emp.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment