[FIX] Return 0 instead of nil when calling maximum on result set. This is inline with rails. Causes exception in Spree's 'cache_key_for_product' when no products are available otherwise.
[FIX] Caching doesn't behave correctly because object are instantiated (new) when they are retrieved. Implemented cache_key that takes this into account.