开发者

ActiveRecord::StatementInvalid: PGError: ERROR: relation "instructions" does not exist

HI,

I got this error when i am testing my rails application. I dont have the table named 'instructions'. But it shows a error like "ERROR: relation "instructions" does not exist". Totally, I got same error for 64 tests as 64 errors.

I am using rails 3.0, Ruby 1.9.2, Netbeans 6.8.

PS: I didnt creat Instruction manual for rails application.

Error: test_should_get_index(HomeControllerTest):开发者_高级运维 ActiveRecord::StatementInvalid: PGError: ERROR: relation "instructions" does not exist LINE 1: DELETE FROM "instructions" ^ : DELETE FROM "instructions"

Kindly help me in this regard


You may want to run rake db:test:prepare , the table instructions isn't present in your test database.


Check your fixtures. I hit an error like this when using Rails scaffolding to generate a subclassed resource.

The generator had created files in my test/fixtures/ directory that didn't correspond to any actual tables in my database (since the model was using STI under another table).

When running tests, Rails attempted to instantiate all my fixtures, and an error similar to yours was generated when it could not find a table matching the name of the fixture.

Deleting the unneeded fixture file cleared my error and got tests running.

Hope that helps you, or others who arrive here searching that error, as I did. :]

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜