-
Notifications
You must be signed in to change notification settings - Fork 43
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
calling save on a model should add itself to its collection #51
Comments
You could use collection.create collection.create({ name: 'Jon', last_name: 'Doe' }) |
True, but we often deal with models that are either new OR existing (new/editing). It'd be nice to just call model.isNew ? model.collection.create(model) : model.save(); |
This makes a lot of sense! |
this appears to be a dupe and should be closed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Model.save
on a new model should add itself to its collection (if it has one). This was the behavior I expected, especially after playing withdestroy
and how it correctly removes itself from its collection.Simple example:
The text was updated successfully, but these errors were encountered: