Explicitly nest classes

Basically a reimplementation of https://github.com/spree/spree/pull/1548 before spree_product_groups was split off, and for the same reason.