Forum: Ruby on Rails rss double render problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Kev J. (Guest)
on 2005-12-14 10:19
(Received via mailing list)
I have a simple method

def activities
    @headers["Content-Type"] = "application/xml; charset=utf-8"

    activities = get_activities
    @feed =
    @feed.title = "Activities" = "Cogini"
    @feed.copyright = "Cogini 2005-2006" = "http://localhost:3000/admin/customers/"
    @feed.content = "Activities"
    activities.each do |a|
      @feed_item =
      @feed_item.feed = @feed
      @feed_item.content = activity_link(a)
      @feed.entries << @feed_item
    render :inline => "<?xml version='1.0'
encoding='UTF-8'?>\n#{@feed.build_xml('rss', 2.0)}"

That builds a feed from a set of fixed values + some dynamic data, but I
cannot get it to build the correct rss.

@feed.build_xml returns a string - not the XMLBuilder as promised, so I
simply concatenated the xml header and tried to render, but now I get a
DoubleRenderError - I can't see anywhere else in this where I render

I've also looked at the xml howto and the feedtools tutorial, neither of
them adequately explain how to do what I want - indeed following them
hasn't brought me any closer to getting this working

Jamie M. (Guest)
on 2005-12-14 20:13
(Received via mailing list)
On Wed, 2005-12-14 at 15:22 +0700, Kev J. wrote:
> = "http://localhost:3000/admin/customers/"
> hasn't brought me any closer to getting this working
> Kev

Three things that might help.

I think the problem is that you're doing an inline render, but the
method is finishing and it still wants to use the view template.

Solution one: move your inline render to the view, since you already
have @feed available.

Solution two: Not sure if this will work exactly, but what happens if
you render :text instead of :inline?

Solution three: Also not sure if this is the issue or not, but if you
return false from your action, I believe it should suppress rendering of
the template.

- Jamie
This topic is locked and can not be replied to.