# Renamed Table, Test Failing

**URL:** <https://www.ruby-forum.com/t/renamed-table-test-failing/173316>\
**Category:** Rails\
**Created:** [August 6, 2009, 7:11pm UTC](https://www.ruby-forum.com/t/renamed-table-test-failing/173316 "2009-08-06T19:11:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rwhiten1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ec8ea/32.png) [@rwhiten1](https://www.ruby-forum.com/u/rwhiten1)\
**Post date:** [August 6, 2009, 7:11pm UTC](https://www.ruby-forum.com/t/renamed-table-test-failing/173316/1 "2009-08-06T19:11:12Z")

</div>

Hey all -

I’m brand new to both Ruby & Rails coming from a long history of C-  
style syntax. I’m trying to assimilate a lot of things at the same  
time, so I’m bumping into all kinds of issues. Many I can track down  
via Google, but I’m stuck on this one.

I had a File model that I generated. A few hours later I learned that  
“file” is a reserved word so I created a db migration to change the  
table name to “binaries” and made all of the other file changes I  
could think of. I must have missed at least one (I renamed and  
modified models/file.rb and test/unit/file\_test.rb). For this model,  
it’s _only_ a model (no controller, view, helper, etc.). There is no  
content beyond the default in the unit test so far, but it’s still  
failing:

require ‘test\_helper’

class BinaryTest \< ActiveSupport::TestCase  
def test\_should\_be\_valid  
assert Binary.new.valid?  
end  
end

Clearly I’ve missed something b/c my unit test output is:

$ ruby unit/binary\_test.rb  
Loaded suite unit/binary\_test  
Started  
E  
Finished in 0.00438 seconds.

1. Error:  
test\_should\_be\_valid(BinaryTest):  
ActiveRecord::StatementInvalid: Mysql::Error: Table  
‘rphoto\_test.files’ doesn’t exist: DELETE FROM `files`

1 tests, 0 assertions, 0 failures, 1 errors

I did update my test db using rake db:test:load. Can someone point me  
in the right direction?

Much appreciated.

---

<div class="post-metadata">

**Author:** ![rwhiten1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ec8ea/32.png) [@rwhiten1](https://www.ruby-forum.com/u/rwhiten1)\
**Post date:** [August 6, 2009, 7:18pm UTC](https://www.ruby-forum.com/t/renamed-table-test-failing/173316/2 "2009-08-06T19:18:49Z")

</div>

Rob W. wrote:

> Clearly I’ve missed something b/c my unit test output is:
> 
> $ ruby unit/binary\_test.rb  
> Loaded suite unit/binary\_test  
> Started  
> E  
> Finished in 0.00438 seconds.
> 
> 1. Error:  
> test\_should\_be\_valid(BinaryTest):  
> ActiveRecord::StatementInvalid: Mysql::Error: Table  
> ‘rphoto\_test.files’ doesn’t exist: DELETE FROM `files`
> 
> 1 tests, 0 assertions, 0 failures, 1 errors
> 
> I did update my test db using rake db:test:load. Can someone point me  
> in the right direction?
> 
> Much appreciated.

Sounds like fixtures, check your fixtures folder for the culprit

Secondly, in the future when you make a new model though the generators,  
observe the files it creates, then if you have to reverse, you will know  
what to delete…

hth

ilan

---

<div class="post-metadata">

**Author:** ![rwhiten1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3ec8ea/32.png) [@rwhiten1](https://www.ruby-forum.com/u/rwhiten1)\
**Post date:** [August 6, 2009, 8:49pm UTC](https://www.ruby-forum.com/t/renamed-table-test-failing/173316/3 "2009-08-06T20:49:32Z")

</div>

On Aug 6, 1:18 pm, Ilan B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Sounds like fixtures, check your fixtures folder for the culprit

That was it, thank you. The fixture file was still named files.yml
