This project is archived and is in readonly mode.

#2373 ✓ resolved
greenagain

record sensitive procs for to_xml

Reported by greenagain | March 30th, 2009 @ 01:41 AM | in 3.0.2

This adds support for an additional argument to procs passed into to_xml via the :procs argument such that, if supplied, the additional argument will be filled with the record being serialized.

An example that this solves: adding data conventionally within the scope of the controller (urls, for example) to an xml-formatted series of ActiveRecord models. Possible alternatives to using record-sensitive procs include creating url-generating methods in the model and referencing them in to_xml's :methods -- a violation of MVC -- and writing a builder template -- a chore, considering to_xml gets you 99% there.

A longer description of what this solves appears here: http://stackoverflow.com/questio...

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 »

Tickets have moved to Github

The new ticket tracker is available at https://github.com/rails/rails/issues

Shared Ticket Bins

Attachments

Referenced by

Pages