Closed felixbuenemann closed 8 years ago
I've already got a fix for this in the works (see felixbuenemann/postgres_ext-serializers@f75ae0e), but it's currently based on top of #50 so it either needs to wait or requires rebasing. It also wouldn't hurt to add a test that calls to_json
at least twice.
If the
to_json
method is called multiple times on anActiveModel::ArraySerializer
, ActiveRecord throws aPG::DuplicateAlias
error, because the internal state is not cleaned up.Proposed Fix: Extract the instance variables set in initialize into a reset method and call it at the beginning of
_postgres_serializable_array
.