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

ActiveModelSerializer doesn't properly translate the error keys for associations #2600

Closed
piotrpalek opened this issue Dec 16, 2014 · 12 comments

Comments

@piotrpalek
Copy link

Hey, so I've come across this weird issue, where I had an offerCategory property (relationship) on my model, and when I saved it, and the server responded with 422 it didn't populate the models errors property with the corresponding error.

As far as I've checked the response should be good, so I changed the property name to offer_category and suddently the errors were populated.

I think I've found the bug and fixed a test which was supposed to test this case, but wasn't actually testing it (I think..). Link here: piotrpalek@15381f9.

@sly7-7
Copy link
Contributor

sly7-7 commented Dec 22, 2014

I debug this with @piotrpalek and it turned out that the jqxhr.status in the response must be an number.
Otherwise, the normalization process is not executed.

@sly7-7 sly7-7 closed this as completed Dec 22, 2014
@sly7-7 sly7-7 changed the title ActiveModelAdapter doesn't properly translate the error keys ActiveModelSerializer doesn't properly translate the error keys for associations Dec 22, 2014
@sly7-7
Copy link
Contributor

sly7-7 commented Dec 22, 2014

I'm reopening since it seems like there is an inconsistency between what Rails AMS is sending and what ED expects.
see http://emberjs.jsbin.com/telatixebi/1/edit?html,js,output
cc/ @igorT

@steveklabnik I was not able to find out clearly what AMS is doing about serializing the errors hash, is this something it cares about ?

@sly7-7 sly7-7 reopened this Dec 22, 2014
@steveklabnik
Copy link

AMS is undergoing some amount of re-write, and I'm not the primary maintainer anymore. which version of AMS is involved?

@sly7-7
Copy link
Contributor

sly7-7 commented Dec 22, 2014

It's on 0.9-stable. Maybe I can directly ping the primary maintainer ?

@steveklabnik
Copy link

So here's the deal: 0.8 is encouraged as the primary version, 0.9 is getting bugfixes but isn't encouraged. @kurko is working on 0.10, which is based on 0.8, and is the road forward.

@sly7-7
Copy link
Contributor

sly7-7 commented Dec 22, 2014

Wow, good to know, thank you.

@piotrpalek
Copy link
Author

@sly7-7 any thoughts on this, what could be the solution?

@sly7-7
Copy link
Contributor

sly7-7 commented Jan 15, 2015

@piotrpalek To be honest, I don't know. Actually there is a bug, or at least Rails AMS and Ember-Data AMS are inconsistent. Before doing anything, I'd like to know where the truth is.
cc/ @kurko @igorT

@tonycoco
Copy link

This is currently still an issue with AMS and DS.Errors, the above reference PR #2601 still fixes it too. Any idea why that was closed without a merge?

@kurko
Copy link
Contributor

kurko commented Feb 18, 2015

Given Ember has an adapter for AMS, I believe the truth is likely to be AMS. IMO Ember should then conform to it. I don't use 0.9 so I don't really have enough info to help, but I'd suggest fixing this on the Ember side with the #2601 PR mentioned above.

@pangratz
Copy link
Member

pangratz commented May 5, 2015

I think this issue has been addressed in #3030, #3036 and #3040 ...

@sly7-7
Copy link
Contributor

sly7-7 commented May 5, 2015

@pangratz Thanks a lot, I'm closing it. @piotrpalek @tonycoco It would be great if you could confirm this issue is gone.

@sly7-7 sly7-7 closed this as completed May 5, 2015
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

6 participants