Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
db_connect.rb 343 Bytes
Copy Edit Web IDE Raw Blame History
xiaominger authored 2014-07-06 12:08 . add dic
require "rubygems"
require "bundler/setup"
require "active_record"
require 'yaml'
project_root = File.dirname(File.absolute_path(__FILE__))
Dir.glob(project_root + "/models/*.rb").each { |f| require f }
connection_details = YAML::load(File.open(project_root+'/config/database.yml'))
ActiveRecord::Base.establish_connection(connection_details)

Comment ( 0 )

Sign in for post a comment