请高手帮看看这个问题,脱离Rails使用ActiveRecord出现Could not find table 'products'的错误代码如下:require 'rubygems'require 'active_record'ActiveRecord::Base.establish_connection(:adapter => "sqlite3" ,:database => "db/development.sqlites3")class Product < ActiveRecord::Baseend
2 回答
暮色呼如
TA贡献1853条经验 获得超9个赞
我正好做了类似的事情,给你参考:
require 'rubygems'require 'active_record'$conn_db = {
:adapter => "mysql2",
:host => "192.168.3.199",
:database => "aaa_db",
:username => "root",
:password => "pppppp",
:pool => 5}
class MyTable < ActiveRecord::Base
establish_connection $conn_db;
end
.... [其他ruby代码]- 2 回答
- 0 关注
- 368 浏览
添加回答
举报
0/150
提交
取消
