Ruby on Rails Monday, November 28, 2011

2011/11/26 Matt Jones <al2o3cr@gmail.com>:
> Looks like you need a slightly different format for the XML:
>
> http://stackoverflow.com/questions/4698266/creating-multiple-resources-in-a-single-restful-post-in-rails

I try this type of XML

<playlist>
<id>7</id>
<name>metal</name>
<images_attributes type="array">
<image>
<id>3</id>
</image>
</images_attributes>
</playlist>

but I receive this error:

Couldn't find Image with ID=3 for Playlist with ID=7

app/controllers/playlists_controller.rb:43:in `block in update'
app/controllers/playlists_controller.rb:42:in `update'

"playlist"=>{"id"=>"7",
"name"=>"metal",
"images_attributes"=>[{"id"=>"3"}]},
"id"=>"7",
"format"=>"xml"}

The image ID 3 already exist!

It's very strange ... I don't think I'm in a case corner, It's common
in REST service have this type of information ...

bye
Gianluca

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment