簡體   English   中英

ActiveRecord :: StatementInvalid:找不到表'tablename'

[英]ActiveRecord::StatementInvalid: Could not find table 'tablename'

cis.statbib.org: script/console 
Loading development environment (Rails 2.2.2)
Article.founc>> Article.count()
ActiveRecord::StatementInvalid: Could not find table 'article'
    from /home/hadley/web/cis.statbib.org/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
    from /home/hadley/web/cis.statbib.org/vendor/rails/activesupport/lib/active_support/core_ext/object/misc.rb:39:in `returning'
...

但它似乎確實存在於數據庫中:

db: sqlite3 development.sqlite3 
SQLite version 3.2.8
sqlite> select count(*) from author;
168600

我剛剛更新了所有的寶石,等等。出了什么問題?

這似乎是由ActiveRecord中的一個錯誤導致的, http: //rails.lighthouseapp.com/projects/8994/tickets/99-sqlite-connection-failing。 按照該鏈接中的描述修補文件修復了問題。

正如Sarah Mei在評論中已經指出的那樣,你手動檢查“作者”而不是“文章”。

但是,其他東西也可能在這里。 您是否故意將表名設置為模型中的“文章”? 默認情況下,這應該是尋找“文章”(復數)表,所以我懷疑有更多的代碼,我們沒有看到哪些可能導致麻煩。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM