#154 invalid

options for to_json

Reported by Ivan | February 12th, 2008 @ 04:26 PM

it would be nice if the to_json method had the same kind of options that can be found in ActiveRecord since Rails 2.0, like the ability to include associations when you want to render a collection of objects in a controller.

Comments and changes to this ticket

  • Sam Smoot

    Sam Smoot March 17th, 2008 @ 10:41 AM

    • State changed from “new” to “invalid”

    We made a specific choice not to do this. Our to_xml, to_json support is for serialization only. We don't really want to provide a sort of "poor man's view". You should be using some sort of builder or view for that.

    That was our thinking at the time at least. I'm not saying I'd reject a solid, well-specced patch on the issue. It'd probably be a bit difficult to manage until associations are finished in 0.9.0 though.

    Closing this out for now, and if you want to revisit it later when 0.9.0 is farther along, and submit a patch, then feel free to create a new ticket.

    Thanks, -Sam

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

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

People watching this ticket