Archive for November, 2007

Nov 29

It took me many hours to find out why my sessions are often gone when using memcache session storage.

Then I remember, that I cannot simply store any objects to a memcache session storage!

In the older rails, we have to do:

model :cart

to store an object of class Cart.

In the newer rails, just replace ‘model’ with ‘require_dependency‘.

For more info, read this site under If you have an “uninitialized constant” error

Nov 08

This happened to me today when using ActiveResource.

For example, Order.find(:all), whereby Order is an ActiveResource object, always returns the ‘cant mass-assign’ error.

The error is really not informative.

So after a couple of head-scratching hours, it turns out that if the result of Order.find(:all) includes a Shipment object, for example, then we should not have an ActiveRecord app/models/shipment.rb in our application.

It’s just a naming conflict it seems. I’m not really sure why this happens, but hopefully this helps others who may encounter the same problem.