84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
代码如下: require 'rubygems' require 'active_record'
ActiveRecord::Base.establish_connection( :adapter => "sqlite3" , :database => "db/development.sqlites3" )
class Product < ActiveRecord::Base end
人生最曼妙的风景,竟是内心的淡定与从容!
I happened to do something similar, for your reference:
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代码]
Are you sure there is this table in the database?
rake db:create rake db:migrate
I happened to do something similar, for your reference:
Are you sure there is this table in the database?
rake db:create
rake db:migrate