Skip to content

Attributes/Persistence not friendly to noSQL embedding #40

Open
@Startouf

Description

@Startouf

As discussed in the slack, embedded noSQL relationships are not easily integratable in JsonapiCompliable module.

The current logic assumes a foreign_key is required to save associations, however Mongoid's embeds_one and embeds_many do not require the foreign key but the parent object itself. The nested objects are directly added as an attribute hash to the parent_object. It is almost as if it behaved as an attribute (with the big difference that embedded records are identified by an ID, indexable, and a special Mongoid proxy allows to use Active Model scopes on embedded relations)

In a nutshell, the resource #create, #update, and maybe even #destroy methods need a way to access the parent_object of the relation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions