Association not found errors after updating to rails 1.2

I recently updated my rails version to freeze 1.2.1, and now I'm getting application errors with messages such as this:

   Association named 'highlights' was not found; perhaps you misspelled it?

I load the page once, it works fine.
The subsequent time I access it, this error comes up.
Restarting the server fixes it for another request.

I'm really puzzled by this, and it seems to be happening across my entire app with most/all associations. Where do I start!?


I had the same problem. There was a library I loaded with require ‘digit_validations’ in environment.rb

then I used it in a model to “include DigitValidations”

digit_validations.rb looked like this:

module DigitValidations
class DiVa


going to script/console and doing a reload!, showed me that I couldn’t reload:

NameError: cannot remove Object::DiVa
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:423:in remove_const' from /opt/local/lib/ruby/gems/1.8/gems/activesupport- 1.4.0/lib/active_support/dependencies.rb:423:in send’
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:423:in remove_constant' from /opt/local/lib/ruby/gems/1.8/gems/activesupport- 1.4.0/lib/active_support/dependencies.rb:274:in remove_unloadable_constants!’
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:274:in each' from /opt/local/lib/ruby/gems/1.8/gems/activesupport- 1.4.0/lib/active_support/dependencies.rb:274:in remove_unloadable_constants!’
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:73:in clear' from /opt/local/lib/ruby/gems/1.8/gems/rails- 1.2.1/lib/dispatcher.rb:60:in reset_application!’
from /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.1/lib/console_app.rb:26:in `reload!’
from (irb):15

I removed the “include DigitValidations” from my models and changed the source where appropriate.

Hope it helps.