quick icon indicating copy to clipboard operation
quick copied to clipboard

Helper function to create, but not save, related entities

Open MordantWastrel opened this issue 4 years ago • 0 comments

Problem: .create() always persists entities and while you used to be able to use associate() on a belongsTo() to associate objects in memory without saving them, now you can't do that with new entities since you can't call Posts.user() unless Post has been hydrated.

Proposed solutions:

  1. Create a .new() function that does exactly what .create() does, only doesn't save anything; or
  2. Add a save argument to .create() that defaults to true, but when false, skips the .save() call.

MordantWastrel avatar Sep 21 '20 19:09 MordantWastrel