ember-changeset icon indicating copy to clipboard operation
ember-changeset copied to clipboard

Validation of associated models (Question)

Open sudhirt4 opened this issue 8 years ago • 9 comments

Hi,

I am using "ember-changeset" along with "ember-changeset-validation" for client side validation. Going through the docs, I couldn't find any information regarding how changeset works with ember model association (belongsTo, hasMany).

Currently, I require validation of objects having hasMany relation to my model, Am I supposed to create changeset for every objects in the hasMany association ? This could be a tedious process when the objects are being added/removed dynamically.

Would really like to know the opinion of "ember-changset" regarding this case.

Thanks

sudhirt4 avatar Sep 26 '16 14:09 sudhirt4

At the moment there isn't much support for hasManys, but belongsTo relationships should work fine.

I'm unsure if a parent changeset should automatically create a changeset for each hasMany association. Could you share how you currently solve this?

poteto avatar Oct 17 '16 19:10 poteto

+1

remithomas avatar Nov 14 '16 14:11 remithomas

@sudhirt4 I'll probably face this issue in the near future. Could you share with us how you currently solve this?

viniciussbs avatar Dec 26 '16 14:12 viniciussbs

Any updates on this? I am facing a similar issue!!

Charizard avatar May 19 '17 18:05 Charizard

Any updates on this subject? It would be nice to create chance set for each hasMany relationships.

GCorbel avatar Oct 20 '18 18:10 GCorbel

@GCorbel Currently going through a rewrite to solve issues. Will circle back when that is done.

snewcomer avatar Oct 20 '18 21:10 snewcomer

Nice. Just to know, because I need it for my current project, do you think it will take a long time?

GCorbel avatar Oct 20 '18 21:10 GCorbel

@GCorbel Using version 1.3.0 should be perfectly fine for most cases. After this version, a concept called Relay was added for nested key setter support. However, that has caused pain in a variety of uses cases. So 2.0.0 will try to get back to1.3.0 + lots of improvements.

Hopefully by mid-November but no promises :trollface:

snewcomer avatar Oct 20 '18 22:10 snewcomer

Thanks, I will try with 1.3.0. Let me know if I can help.

GCorbel avatar Oct 20 '18 23:10 GCorbel