adopted-ember-addons / adopted-ember-addons/ember-changeset-validations

Promise-based validation example and best practices?

Aperta
#124 2 commenti 3 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
215
Fork
98
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hey,

Thanks for the great library. I've noticed that you can return a promise from a custom validator leading me to believe I could write validators that query a remote backend. The most common use-case for this would be checking for other instances of a model with the same value (unique email for example).

It would be great to see a more verbose example this. I'm not sure what is the best way of getting access to the data `store` as an injected dependency. From my understanding (based largely on [this SO answer](http://stackoverflow.com/a/34971940/396300)) you would need to declare the validator as an Object and register it with the container to be able to inject the store dynamically.

I may be overthinking this but would like to hear about some best practices when needing to interact with other models during validation.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.