This project is archived and is in readonly mode.

#6413 ✓invalid
Wojciech Wnętrzak

[PATCH] respond_with with array of resources not working

Reported by Wojciech Wnętrzak | February 11th, 2011 @ 10:01 AM

There is a problem with respond_with arguments. Those examples behaves completely different (second one is working incorrect):

    respond_with(:admin, @post)
    respond_with([:admin, @post])

When there is passed array of resources, in this place, variable resources looks like this: [[arg1, arg2]] which is wrong. After writing a patch, one other test is falling, however I don't know what should be the correct behaviour there.
So my question is: what should look like response from api request (i.e. xml) of respond_with([:admin, @post]) - should there be only @post included or maybe :admin also?
Now it returns both arguments, however code says that this should be single resource (not resources), but now resource is mistakenly taken as passed array.

I'm submiting patches with respond_with fix and test for it - after applying them, this test is falling.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages