RobinWu 发表于 2013-2-4 19:00:30

Establish an ActiveRecord connection with a YAML c

http://snippets.dzone.com/posts/show/6925
 


rmu_db_config.yml
host: localhostdatabase: xxxxpassword: xxxx
 

require 'rubygems'require 'active_record'dbconfig = YAML::load(File.open('rmu_db_config.yml'))ActiveRecord::Base.establish_connection(dbconfig) class Member < ActiveRecord::Baseend p participant = Member.find(:all) 
页: [1]
查看完整版本: Establish an ActiveRecord connection with a YAML c