Forum: Ruby on Rails AssociationTypeMismatch / Model Caching in development environment

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.
C446137299be4a0664a9bc5c18dedc18?d=identicon&s=25 Chad Moone (chadmoone)
on 2010-10-15 07:36
Hi there—

I'm trying to get started with Rails, and I've run into this issue and
searched high and low--so hopefully someone can help point me in the
right direction.

I'm having an issue where my model classes seem to be getting cached by
something, and so if I make subsequent requests, I get an
AssociationTypeMismatch error.  To be specific, on update is where it
fails, and I get:

ActiveRecord::AssociationTypeMismatch in ArticlesController#update
Category(#2159283720) expected, got Category(#2154954600)

So sometimes this is successful, and the POST requests are identical.

I can change the 'config.cache_classes = false' to true in the
config/environments/development to true and i won't get the error
anymore, but then I have to reload the server every time I make a
change.

I read that plugins could be caching it since they don't reload for
every
request, but I don't think I'm using any plugins, so I'm guessing that
isn't it.

I can't figure out where to look next and would appreciate any help you
can offer.

I'm running Ruby 1.9.2p0 and Rails 3.0.1 on OS X 10.6.4.  You can
download the code that I'm trying to work on at
http://github.com/downloads/ccjr/blog/chapter08.zip (I'm trying to work
through this Apress book).  When you load up the page, you need to log
in to edit, and the login is 'mary@example.com' : 'guessit'.

Any pointers or ideas?
This topic is locked and can not be replied to.