quick
quick copied to clipboard
Helper function to create, but not save, related entities
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:
- Create a
.new()
function that does exactly what.create()
does, only doesn't save anything; or - Add a
save
argument to.create()
that defaults to true, but when false, skips the.save()
call.