Rss double render problem

I have a simple method

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

activities = get_activities
@feed = FeedTools::Feed.new
@feed.title = "Activities"
@feed.author = "Cogini"
@feed.copyright = "Cogini 2005-2006"
@feed.link = "http://localhost:3000/admin/customers/"
@feed.content = "Activities"
activities.each do |a|
  @feed_item = FeedTools::FeedItem.new
  @feed_item.feed = @feed
  @feed_item.content = activity_link(a)
  @feed.entries << @feed_item
end
render :inline => "<?xml version='1.0'

encoding=‘UTF-8’?>\n#{@feed.build_xml(‘rss’, 2.0)}"
end

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
previously

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

Kev

On Wed, 2005-12-14 at 15:22 +0700, Kev J. wrote:

@feed.link = "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