Hacker Newsnew | comments | show | ask | jobs | submitlogin
renownedmedia 891 days ago | link | parent

Man, I must have been doing something wrong with my models. I'm getting this error in my console when normally it triggers my validation errors:

"Uncaught Error: Can't create an invalid model"



jashkenas 891 days ago | link

Validation has gotten an overhaul -- I'm afraid it'll no longer allow you to create a model in an initially invalid state.

If you'd like to keep the same flow, first create an empty model, then `.set` the attributes on it.

-----

jashkenas 890 days ago | link

Looks like I managed to miss adding that bit to the changelog -- it's in there now.

-----

terryroe 890 days ago | link

I don't understand. If you create an empty model and you have a validate function, the validate function still runs and you aren't able to create the model.

Also, I don't fully understand the workflow for a "new" form. If the form needs to handle both a "new" model with no attributes (invalid state) and an existing model for update, how does one go about that? (I'm currently using a mock for the new state.)

I realize this are two different issues, but they are somewhat related to the problem of creating a model with no attributes, which is a model in an initially invalid state.

-----




Guidelines | FAQ | Lists | Bookmarklet | DMCA | News News | Bugs and Feature Requests | Y Combinator | Apply | Library | Contact

Search: