Skip to content

HABTM Association causes sync() to save model. #64

@SirRawlins

Description

@SirRawlins

I've been experimenting today and found that if you have a HABTM association which is set through disposable such as tag_ids then the underlying active record will save itself when the setter for that attribute is invoked.

This means that calling sync() on disposable can inadvertently save the underlying record. This would presumably also happen with has_many associations of a similar nature that AR also likes to autosave.

This is a quirk with AR rather than anything specific to Disposable, but after a Gitter conversation with @apotonick he asked me to file this as a reminder to anyone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions