polymorphic associations are scopeable

This patch enables the scope for a polymorphic association to be set (in the same way as it already works in the non polymorphic associations).
It enables caching if a scope is set.