Method in Model

Hi Joe,

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.

Good luck,


Hi Joe,

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 <

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:

include Reloadable

See also:

Let us know how it goes! :slight_smile:


Thank you sooooo much for asking this question. I have had the exact
same problem today and have wasted about 6 hours including all the

Also, thanks to all who have taken the time to answer.