Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] Support for loading nested arrays, numbers and symbols in ActiveResource

#2394

It appeared that ActiveResource can't load a nested array, only a flat array of strings (and not even array of numbers).

Check out:


# given that person is an ActiveResource object
person.load {:items => [['first', 'black'], ['second', 'red']]
# => ArgumentError: expected an attributes Hash, got ["first", "black"]

The patch attached to the ticket contains a fix and a test case. Works very well for me. It can load infinitely nested arrays.

Reported by Ilya Sabanin · April 1st, 2009 @ 06:11 PM

State: stale
Milestone: 3.x
Assigned to: nobody
Importance: none

Activity

  1. Ilya Sabanin
    Ilya Sabanin

    Here is one more patch that adds support for Numbers and Symbols in arrays that ActiveResource can load. Right now you can only load an arrays of strings, nothing else.

    That new patch should be after the previous "nested_arrays_support_for_ares.diff" one because it's using the code introduced in that patch.

    Tests are also included.

    April 1st, 2009 @ 07:11 PM

  2. Ilya Sabanin
    Ilya Sabanin
    • Title changed from Support for loading nested arrays in ActiveResource to Support for loading nested arrays, numbers and symbols in ActiveResource

    April 1st, 2009 @ 07:11 PM

  3. Ilya Sabanin
    Ilya Sabanin
    • Title changed from Support for loading nested arrays, numbers and symbols in ActiveResource to [PATCH] Support for loading nested arrays, numbers and symbols in ActiveResource

    April 1st, 2009 @ 07:12 PM

  4. Alexey Kovyrin
    Alexey Kovyrin

    +1 - definitely makes sense to support these

    April 1st, 2009 @ 11:29 PM

  5. Dima Sabanin
  6. Petyo Ivanov
  7. ronin-52805 (at lighthouseapp)
  8. Victor Gumayunov
  9. closer
    closer

    +1, I think it is time to fix absurd mistakes and don't move them to 3.x release :)

    April 3rd, 2009 @ 04:45 PM

  10. Ilya Sabanin
    Ilya Sabanin
    • Tag changed from active_resource, patch, tested to 2-3-stable, active_resource, patch, tested

    April 18th, 2009 @ 02:54 PM

  11. Zach Brock
    Zach Brock
    • Tag changed from 2-3-stable, active_resource, patch, tested to 2-3-stable, active_resource, patch, tested, verified

    April 20th, 2009 @ 12:20 AM

  12. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  13. Ilya Sabanin
    Ilya Sabanin
    • Importance changed from to

    The problem is not reproducible in Rails 3 anymore, looks like the problem was fixed. We can close this out.

    October 24th, 2010 @ 05:33 PM

  14. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:28 PM

  15. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:28 PM