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

isNew() on model treats blank ids as if an id exists and sends .save() calls to update() #86

Closed
uTestMichaelL opened this issue Nov 8, 2011 · 2 comments

Comments

@uTestMichaelL
Copy link

Since formParams() returns {id: ""} from a form with a field
this breaks the formParams() and isNew() integration.

From Justin on: http://forum.javascriptmvc.com/topic/isnew-on-model-treats-blank-ids-as-if-an-id-exists-and-sends-save-calls-to-update

"Those two are made for each other. We can probably change it to ignore an empty string too. "

@daffl
Copy link
Contributor

daffl commented Nov 8, 2011

It does ignore empty strings when using

$(form).form_params(true)

This converts strings that look like numbers and booleans and empty strings will be ignored.
Maybe we should default it to true?

@daffl
Copy link
Contributor

daffl commented Nov 8, 2011

I also updated the isNew check in $.Model. An empty string as a model id can't be used anyway.

@daffl daffl closed this as completed Nov 8, 2011
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