Skip to content

document_setter does not update corresponding id field in belongs_to_document relationship #38

@ozydingo

Description

@ozydingo

t2 is an object that belongs_to_document :media_file_datum

2.2.2 > t2.media_file_datum_id
 => <BSON::ObjectId:0x70280566925080 data=562c40fc616e64235b000001>
2.2.2 > t2.media_file_datum = MediaFileDatum.new(content: tt.media_file_datum.content)
2.2.2 > t2.media_file_datum_id
 => <BSON::ObjectId:0x70280379751960 data=562c40fc616e64235b000001>
2.2.2 > t2.media_file_datum.id
 => <BSON::ObjectId:0x70280566955560 data=5640caae416e64d29a00000c>

Expected behavior is that calling t2.media_file_datum= should set the media_file_datum_id field as well, which occurs for Rails (4) belongs_to associations. I suspect a similar situation for has_one as but I don't have that setup currently. I'm happy to work on a PR for this perhaps by next week.

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