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

Promise-based validation example and best practices?

オープン
#124 コメント 2 件 リアクション 3 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
215
フォーク
98
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。