Skip to content

The serialized hash from represent can like back to the original ActiveRecord data when using PostgreSQL native types like JSON or HStore #200

Open
@idyll

Description

@idyll

First off, I am not sure that GrapeEntity is the place to fix this. But we should talk about this here at least.

When an object is serialized I would expect the serialization to produce a copy of the data in the object. Modifying the serialized hash should not modify the original object.

This is not the case if the original object contains a hash, for example when an ActiveRecord Model object contains JSON or an HStore. Modifying that data in the resultant serializable hash actually modifies the original JSON or HStore data on the active record object.

In order to protect the integrity of these datatypes I've resorted to the exposing a "dup'd" version of the object.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions