This project is archived and is in readonly mode.
record sensitive procs for to_xml
-
ppowpow
This would be awesome, and could actually make procs useful for serialization of arrays of AR objects. Why, O why is this patch sitting in here and not getting any love?
-
greenagain
Appreciate the support, ppowpow. I think that this would be extraordinarily useful too, especially for so tiny a change. I tried to tag and categorize the ticket properly. Does it seem like I filed it wrong or something?
-
ppowpow
Looks like you did it by the book; did you try asking for feedback from the community at large? I just stumbled across the page at stackoverflow and found my way here.
From the contrib guide:
Once you have a patch and a lighthouse ticket you need to find some people to give you feedback. You can either email the core list or ask in #rails-contrib on irc.freenode.net
-
greenagain
Thanks for pointing that part of the contribution guide out. I posted to the Rails core group: http://groups.google.com/group/rubyonrails-core/t/d5276f6ecc6359cf?...
Hopefully it will catch someone's eye now :)
-
Michael Koziarski
Remove the ternary operator, it just obfuscates things:
if proc.arity == 1
proc.call ... else
proc.call ... endAlso update the docs so that it explains why you might want to do this, 9 times out of 10 you're better off overriding .to_xml in your object, but this 'include a url' case is a good reason not to.
-
greenagain
Thanks for the feedback, Koz :) I've implemented your suggestions and revised the patch, which is now attached. The implementation of AR's XML Serialization has moved into ActiveModel, so I moved my patch there. I also added unit tests for the :procs option in ActiveModel.
-
Repository
- State changed from new to resolved
(from [c39151a84768397d3bb025c6e8f877eac59ebbf9]) Patch to ActiveModel's (and ActiveRecord, by association) XML serialization: If two parameters are present in Procs supplied to to_xml's :procs option, the model being serialized will be passed as the second argument [#2373 record sensitive procs for to_xml state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com
http://github.com/rails/rails/commit/c39151a84768397d3bb025c6e8f877...
