Render from your Model

Ok, with MVC anti-purism aside, how can I render an RXML template from
a Model? I have a Model object which I want to serialize to XML. I
originally had all my XML generation methods inside the Model object
itself and that works just fine, but now I want to clean up the object
and I think it would be best to put in an RXML template. But none of
the render() set of methods work from a Model, only

Someone has blogged about this before at:

But the problem with this approach is that you cannot assign variables
and/or the template does not pick up any instance variables you have
set in your model prior to the render() call.

So does anybody have any ideas? Or should I just go back to the
stone-age and place my XML right in the Model?



Why not just use to_xml() ? ( Rails 1.2 & Edge )


- Lourens

I cannot use to_xml() because my XML is not generic enough, its

I was able to get that one Module to work, that is:

Thanks for all your ideas and help!

Sure you can.


Straight from the docs:

     # To include any methods on the object(s) being called use :methods