views:

100

answers:

1

Hi!

Is it possible to receive objects of different Active Resource models in a single request? For example the request "GET /user/joe/articles/1.xml HTTP/1.1" returns an object from User ("joe") and another object from Article (id "1") from the server.

I know it is possible to send these objects inside an array to the client, but ARes can't process them. Is there anyway to "break" the response in two and send the results to different Active Resource models for processing?

Thanks in advance for your answers!

A: 

I think what you want to do is include the user xml inside the article xml that is returned.

If you are using ActiveRecord to make the xml the you can use the :include parameter of the to xml call to get the user included in the article response. The output is something like

<article>
  ...
  <user>
    ...
  </user>
</article>

You should then be able to call '.user' on the returned article object to get at the user properties.

Corey