require 'active_record'
# Change the following to reflect your database settings
ActiveRecord::Base.establish_connection(
adapter: 'mysql2', # or 'postgresql' or 'sqlite3' or 'oracle_enhanced'
host: 'localhost',
database: 'your_database',
username: 'your_username',
password: 'your_password'
)
# Define your classes based on the database, as always
class SomeClass < ActiveRecord::Base
#blah, blah, blah
end
# Now do stuff with it
puts SomeClass.find :all
some_class = SomeClass.new
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…