atom_builder and link element

I'm using the atom builder to build a feed. It's mostly working but the value in the link element of each entry is not being generated as it needs to be.

My url scheme looks like http://example.com/blog/nickname/id

I have a controller called blog_entries and a routes.rb file which a seet of maps for blog_entries, it looks something like this (amongst all the other routes):

map.blog_entries 'blog/:nickname',             :controller => "blog_entries",             :action => "index",             :conditions => {:method => :get} map.formatted_blog_entries 'blog/:nickname.:format',             :controller => "blog_entries",             :action => "index",             :conditions => {:method => :get}

In my views, to generate the correct URLs for links I do something like:

<%= link_to 'New Entry', new_blog_entry_path(:nickname => @blog.nickname) %>

and this creates the correct path.

The builder code looks like:

feed.entry(post) do |entry|   entry.title post.title   etc... end

The problem is the generated link in the atom output, it looks like

<link type='....' href="http://example.com/blog/1&quot; />

when what I need is

<link type='....' href="http://example.com/blog/nickname/1&quot; />

I've tried

entry.link :href => "some other url"

but that adds a second link entry into the output which is in the wrong place in the XML so is ignored by readers.

So, can I hook into the url generation mechanism to get the nickname value into the URL, or can I tell the builder to use "nickname" when generating the url?

If not I guess the other thing is to generate the atom feed myself, seems a shame not to use the builder though.