Help with to_xml - Add a custom tag in each ele in a coll.


I was advised to use either the :methods option of to_xml or use a block
to add additional tags to the output. What I'm trying to do is add a
permalink tag to each element in a collection, but I can't seem to get
it right.

If I use the :methods option of to_xml, I'd need to access an url helper
from a model, and I haven't figured that out yet.

When using either a proc or a block I don't know how to get the current
record from the collection in order to use a url helper. For example:

render :xml => @messages do |options|
  options[:builder].tag!('permalink', message_url(WHAT_DO_I_PUT_HERE?)

Any pointers?

Thanks in advance.

- Ivan V.