Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk creating #96

Open
SafaAlfulaij opened this issue May 18, 2021 · 2 comments
Open

Bulk creating #96

SafaAlfulaij opened this issue May 18, 2021 · 2 comments

Comments

@SafaAlfulaij
Copy link

How can use this library to bulk create?
There is nested updating, but I didn't see anything about bulk create (with nested attributes).

@CDidier80
Copy link
Contributor

Can you explain the problem in more detail? I've personally never encountered a use case that called for directly triggering a bulk create in client-side code. If you're using relational database, Spraypaint helps you by performing all needed operations (create, update, delete) simply by calling the save() method on the parent record. So, say you had a User model that "had many" notes, and you wanted to bulk-create many notes at once, all you'd need to is 1) ensure the relationship is described correctly in the Spraypaint model file, 2) attach the new notes to the User record (e.g. User.notes = [// a lot of notes], and run User.save()

@SafaAlfulaij
Copy link
Author

I've stopped using spraypaint.js. What I'm referring to is atomic requests in JSON:API, it helps when we need to batch creation and minimize network requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants