Rails 连接到 MySQL 数据库

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

require "rubygems"
require "activerecord"

ActiveRecord::Base.establish_connection(
  :adapter => "mysql",
  :host => "localhost",
  :username => "root",
  :database => "Contact")

class Employee < ActiveRecord::Base
   set_table_name "employee"
end

account = Employee.new
account.Name = "AAA"
account.save