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

Update validateConfirmation to support confirmation against fields on ember-data objects #348

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robinaugh
Copy link

Changes proposed in this pull request

This addresses the use case I referred to in #137 (comment), which is that when validateConfirmation's resulting function receives an ember-data object as its content, and the original field (say password) is unchanged from that ember-data object, the validating field (say passwordConfirmation) is considered invalid, no matter whether it matches the current content or not.

It looks like @brandynbennett took a stab at addressing this issue with #138 (later merged as #219 by @snewcomer), but that only works with POJOs whose top-level keys include the attributes we're targeting, which for ember-data objects are quite nested.

There may be a better way to grab all of an ember-data object's attributes than what I've got here, which admittedly uses their private API so I'm not thrilled about that, but it does get the job done. Open to suggestions if there's a better approach folks think we should take, or if the fact that we're seeing ember-data objects instead of POROS in a validator means we're just "doing it wrong" somewhere else in my team's code. 😄

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

Successfully merging this pull request may close these issues.

2 participants