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

saving the parent model with blank nested model #15

Open
jbhatab opened this issue Oct 30, 2014 · 2 comments
Open

saving the parent model with blank nested model #15

jbhatab opened this issue Oct 30, 2014 · 2 comments

Comments

@jbhatab
Copy link

jbhatab commented Oct 30, 2014

I am using some form code to create and update a model. This gem has worked great for updating but I need to create a new one and the nested model needs to be blank because the server creates it with an after_save callback.

Does this gem allow for blank nested models or is there something I can do to make that still work?

@vicentemundim
Copy link
Member

Have you tried not passing the attribute when creating, or even passing it as null, or empty array? It should work fine:

var post = new Post({
  id: 123,
  title: 'My Title',
  author: null,
  comments: []
})

@jbhatab
Copy link
Author

jbhatab commented Jan 5, 2015

It's just a an empty collection and seems to be passing itself as nil, but that's raising errors on the rails side.

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