Hey guys,

I have a situation where I'm creating a object which have some items and 
the items have a validation that need to be executed on the server side but 
rails do not map these validation messages to the specific child.

A contrived example may be a invoice which have 2 items and for some reason 
the product of one of these items is not allowed to be inserted:

POST 
/invoices?invoice[items_attributes][0][product_id]=1&invoice[items_attributes][1][product_id]=2


The JSON response when the validation fails is something like:

{"items.product":["is not allowed"]}


But for which item the validation failed? For this JSON response, I can't 
guess if it was the first or the second nor both items.

I was thinking in something like:

{"items.1.product":["is not allowed"]}


Where the 1 is the child index (can't use the id because we do not have it 
for new records).

That's a proposal but we may implement something else.

Suggestions?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to