Skip to content

Update with nested associations #9199

Closed

Description

@MikeDabrowski

I think I dug deep enough (2016) and found only hints that such feature would be awesome to have but is not yet supported.

What is current best way to update models with associations? I understand it might be hard to implement, but I couldn't find in the docs how to do it on your own.

Activity

  1. amgv commented on Mar 19, 2018

    @amgv

    I think that feature isn't supported yet. you can fetch a row from any table and it will be a model instance, so if you include associated models they will be model instances too. for example:

    Student.find({ where: {age: 14}, include: [Classroom],}). then((student) => {})

    student.Classroom will be an instance of model Classroom and you can call student.Classroom.save() to update classroom. but calling student.save() only update students atributes

  2. acanimal commented on Mar 20, 2018

    @acanimal

    Maybe #9204 can help you

  3. sushantdhiman commented on Mar 25, 2018

    @sushantdhiman
    Contributor

    Duplicate of #9233

  4. papb commented on Jan 16, 2020

    @papb
    Member

    This has been centralized in #11836

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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