DavyJonesLocker / postgres_ext-serializers

MIT License
324 stars 30 forks source link

Fix custom embed keys #41

Closed felixbuenemann closed 8 years ago

felixbuenemann commented 8 years ago

This adds support for the :key and :embed_key options for has_many associations in serializers and for the :key option of has_one associations.

There's currently no support for :embed_key on has_one associations, because it would require lookups on the foreign table of the association.

There's also a fix for coalesce on arrays that removes the restriction on integer keys which is required for :embed_key and to support non-integer primary keys, like UUIDs. The type specification in COALESCE is not needed, because it automatically casts the NULL replacement value to the type of the source expression.