Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Atom Feed Helper generates wrong Ids

#1093

Hi!

I think I ran into a bug in the atom feed helper. In my application I have a Blog that can have Comments and I want a atom feed for all the comments.

I create this feed with the atom feed helper:


...
feed.entry([comment.blog,comment]) do |entry|
      entry.title(comment.title)
      entry.content(comment.body, :type => 'html')

      entry.author do |author|
        author.name(comment.user.name)
      end
    end
...

This code generates a valid atom feed but it generates wrong ids for the entries. For instance tag:arche-online.at,2005:Array/-612666458

So the rss reader always marks every comment as new comment because the id changes.

When I change this code to


feed.entry(comment) do |entry|
      ...

it fails creating the URL for this comment.

In the atom_feed_helper.rb I found this (line 122)


@xml.id(options[:id] || "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}")

It's obvious that this is creating the id of the array and not of the object.

I don't know what a good solution for this would be. So i would appreciate some help on that.

Reported by Jonny_K · September 22nd, 2008 @ 07:37 PM

State: wontfix
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Michael Johann
    Michael Johann

    Jonny,

    I guess it would be solved by providing the following:

    
    ...
    feed.entry(comment, :id => comment.id) do |entry|
          entry.title(comment.title)
          entry.content(comment.body, :type => 'html')
    
          entry.author do |author|
            author.name(comment.user.name)
          end
        end
    ...
    

    September 23rd, 2008 @ 12:30 PM

  2. Pratik
    Pratik
    • Assigned user set to Pratik
    • State changed from new to wontfix

    Please submit a failing test case/patch.

    December 23rd, 2008 @ 01:28 PM

  3. Ryan Bigg
    Ryan Bigg
    • Tag changed from 2, actionpack, bug, helper to 2.0-stable actionpack bug helper

    Automatic cleanup of spam.

    October 21st, 2010 @ 03:38 AM

  4. bingbing