Tuesday, December 8, 2009

undefined method `reflect_on_all_associations'

Using Rails 2.3.5 , I started recieving this error when running all unit tests on an older application.:


1) Error:
test_truth(CommitmentTest):
NoMethodError: undefined method `reflect_on_all_associations' for Object:Class


1 tests, 0 assertions, 0 failures, 1 errors


The problem was happening when Rails was trying to load fixtures. Removing all the fixures removed the error. After adding back a few at a time, I narrowed the problem down to the Fixtures for an object called Content :

The Content object has a field called type, which is reserved for Single Table Inheritance. renaming that field solved the problem.

The vague undefined method `reflect_on_all_associations' can have a variety of sources, In general, it means there's a problem with a Model object.

See Also:
http://iridescenturchin.wordpress.com/page/2/
http://sourceforge.jp/projects/rubycocoa/lists/archive/devel/2008-January/001293.html

2 comments:

Sergei Udalov said...

Thanks!! :)

Susan said...

I have been reading out many of your blog and i must say pretty good stuff. I will surely bookmark your site. Find out today ‘s Celebrity birthdays and discover who shares your birthday. We make it simple and entertaining to learn about celebrities.

Popular Articles