views:

1328

answers:

2
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'
...

But it certainly seems like it's there in the database:

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

I've just updated all my gems, etc. What's going wrong?

A: 

As Sarah Mei already pointed out in the comments, you are manually checking for "author" not "article."

However, something else might be off here as well. Did you intentionally set the table name to "article" in your model? By default, that should be looking for the "articles" (plural) table, so I suspect that there's more code that we're not seeing which could be causing trouble.

jdl
Yes, the table name is article, I have ActiveRecord::Base.pluralize_table_names = false in environment.rb (all my table names are singular)
hadley
A: 

This seems to be caused by a bug in ActiveRecord, http://rails.lighthouseapp.com/projects/8994/tickets/99-sqlite-connection-failing. Monkey-patching the file as described in that link fixed the problem.

hadley