Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'rubygems'
require 'active_record'
require 'yaml'  

# load config/database.yml
dbconfig = YAML::load(File.open('/full/path/to/rails/app/config/database.yml'))  
ActiveRecord::Base.establish_connection(dbconfig)

# turn on logging for debugging
# ActiveRecord::Base.logger = Logger.new(STDOUT)

# now you can simply load your model:
#   require '/full/path/to/rails/app/models/user.rb'
# to get all functionality

# or you could just write a simple version of it:
#   class User < ActiveRecord::Base
#   end
# to just get the basic access (finders, count, updates, etc.)