Below is the code that I have in my rails application. I can’t figure out why it’s causing this error? Any ideas where I should start looking? I don’t get where it’s getting the DELETE FROM workloads call from.
The AccountsController & WorkloadsController are both empty.
Test
require 'test_helper'
class AccountTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
Error
2) Error:
test_the_truth(AccountTest):
ActiveRecord::StatementInvalid: TinyTds::Error: Invalid object name 'workloads'.: DELETE FROM [workloads]
Account Model
class Account < ActiveRecord::Base
before_create :set_defaults
set_table_name "Account"
set_primary_key "AccountID"
private
def set_defaults
self.UCPIN = UUIDTools::UUID.timestamp_create.to_s
end
end
Workload Model
class Workload < ActiveRecord::Base
set_primary_key "WorkloadID"
set_table_name "Workload"
end
I found the answer… it has to do with fixtures needing to be redefined and reference. Here’s the site that gave me the answer.
http://www.missiondata.com/blog/systems-integration/80/rails-fixtures-with-models-using-set_table_name/