Anyone using to_xml and procs...

3 views
Skip to first unread message

Jon

unread,
Nov 20, 2007, 12:38:05 PM11/20/07
to Ruby on Rails: Core
I'm looking for comments on http://dev.rubyonrails.org/ticket/10162

In my opinion, the current behaviour is a bug, and should be fixed.
If you have a use case where passing procs to the child associations
is actually useful, chime in.

Jonathan del Strother

Jeremy Kemper

unread,
Nov 20, 2007, 6:25:54 PM11/20/07
to rubyonra...@googlegroups.com

Calling all folks using to_xml with a block -- what do you think?

jeremy

chuyeow

unread,
Nov 21, 2007, 9:53:36 PM11/21/07
to Ruby on Rails: Core
How about something like this instead (that still prevents the top-
level :procs options from being passed on to associations)?

posts_proc = Proc.new { |options| options[:builder].tag!
('copyright', 'DHH') }
xml = authors(:david).to_xml(
:indent => 2,
:include => {
:posts => { :procs => [ posts_proc ] }
}
)

See http://dev.rubyonrails.org/ticket/10162#comment:3 for more
details :)

Cheers,
Chu Yeow


On Nov 21, 7:25 am, "Jeremy Kemper" <jer...@bitsweat.net> wrote:
> On 11/20/07, Jon <jdelStrot...@gmail.com> wrote:
>
> > I'm looking for comments onhttp://dev.rubyonrails.org/ticket/10162
Reply all
Reply to author
Forward
0 new messages