Remove singleton classes on CPK relations.

* Extract CPK methods to its own module and extending instead of opening the singleton class.

* Fix Marshal.dump. Makes caching work again.

This is similar to 169 but works with Rails 4.