It sounds like you're running WebRICK in "production" mode, not
"development" mode... in "production" mode, Rails will only load your
model classes *once*, whereas in "development" mode, it will reload
your model classes on each and every HTTP request... check your
environment ("RAILS_ENV") and/or your config files, and ensure it's
set to "development" mode.
Ok I have done ruby script/console and typed RAILS_ENV and it came back
with development..Was this the way to do it?
Yes, that's one way to do it ... also, as per your previous post, if the development.log is growing but the production.log stays empty, then Rails is definitely running in development mode. I just re-read your original post in more detail, and noticed your very last comment, which I missed the first time around:
In case it matters the cart
model is just 'class Cart' not something like 'class Cart <
Somethingelse'
Yes, it matters quite a lot, actually. Rails will only reload AR model classes, ie. classes that inherit from ActiveRecord::Base... for non-ActiveRecord model classes, you need to help Rails out a bit:
If you want Rails to reload a model that isn't a subclass of ActiveRecord::Base, you used to add the following declaration in a controller:
model :my_model
That syntax is now deprecated in favor of adding the following declaration in your model file: