Renamed Table, Test Failing

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.

Rob Wilkerson 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

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