Forum: Ruby on Rails Association not found errors after updating to rails 1.2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cba8c8adc11ee1152eb6f15ab7071511?d=identicon&s=25 Andrew Vit (Guest)
on 2007-02-03 19:04
(Received via mailing list)
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!?

Andrew
3a18f0e7810b93223a39bf00c9d403b5?d=identicon&s=25 Frodo Larik (Guest)
on 2007-02-12 22:20
(Received via mailing list)
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
        ....
   end
end



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

>> reload!
Reloading...
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
        from :0


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

Hope it helps.

On 2/3/07, Andrew Vit <andrew@dihedral.ca> wrote:
> 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!?
>
> Andrew
>
> >
>


--
Sincerely,

Frodo Larik
This topic is locked and can not be replied to.