开发者

ActiveRecord::StatementInvalid in StoreController#index

So I'm on page 239 of "agile web development with rails 4th ed." I have one tab in my browser pointing to localhost:3000 and it works fine. Another tab is pointing to "depot.thefonso.com" and I get this error:

"ActiveRecord::StatementInvalid in StoreController#index"

SQLite3::SQLException: no such table: products: SELECT "products".* FROM "products" ORDER BY title

Rails.root: /Users/gideon/Desktop/Rails_work/depot

...

app/controllers/store_controller.rb:7:in `index'

here is line 7 in store_controller.rb....

  @products = Product.all

Can any guru point me in the right direction?

HERE IS MY database.yml

# SQLi开发者_开发技巧te version 3.x
#   gem install sqlite3
  development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
 test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000


Did you run cap deploy:migrations (as instructed on page 237)?

From your symptoms, your database doesn't have the Product table defined. I'll also note that you didn't change from sqlite3 to mysql.

Please run the following commands on your two machines and compare the schemas produced:

sqlite3 db/development.sqlite3 .schema

sqlite3 db/production.db .schema


The problem is that Rails can't find the table so if it works locally it's most likely only a configuration problem.

Check your database.yml configuration for the application running on depot.thefonso.com. It's most likely looking for a database on localhost and can't find it on your remote server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜