ruby rails学习二

activerecord脱离rails环境运行
activerecord非常好用的ORM框架,太爽了
操,ruby各个版本的差异还很大,不爽的地方
我日啊!不是一般的强大!!!

安装activerecord, gem install activerecord
安装adapter, gem install activerecord-oracle_enhanced-adapter

require 'active_record'    
        
ActiveRecord::Base.establish_connection(    
:adapter  => 'oracle_enhanced',     
:database => 'xxx',   #oracle service name  
:username => 'HR',     
:password => 'HR') 

     
class Job < ActiveRecord::Base   
end    
        
puts Job.count   

一个英文连接说的很详细
http://blog.aizatto.com/2007/05/21/activerecord-without-rails/
http://blog.aizatto.com/2007/05/27/activerecord-migrations-without-rails/

你可能感兴趣的:(Rails)