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

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?
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.