一个 ActiveRecord的Oracle enhaced adapter

公司在用Oracle,想用ruby写一些测试脚本,在网上找到一个adapter。

https://github.com/rsim/oracle-enhanced/

创建database.yaml文件

adapter: oracle_enhanced
encoding: utf8
host: localhost
port: 1521
database: sid
username: name
password: pwd


编写测试类

require 'rubygems'
require 'active_record'
require 'yaml'

dbconfig = YAML::load(File.open('database.yml'))
ActiveRecord::Base.establish_connection(dbconfig)

class User < ActiveRecord::Base

end

puts User.count

你可能感兴趣的:(ActiveRecord)