Problem with RSS feed from Rails Recipes

I’m trying to add an RSS feed to my app, and am going through the
Rails Recipes chapter on doing so. I get the following error when I
request the feed:

undefined method `gmtime’ for #<DateTime: 1963061961/800,0,2299161>

7: xml.pubDate CGI.rfc1123_date(@posts.first.created_on)

Any idea what’s up?

Pat

Also, checking out the RSS feed in NetNewsWire, it just says “Untitled
Source” and has no items. I validated the feed and it validates fine.
The raw XML looks exactly like the example in Rails Recipes. Not
sure what’s wrong with it.

Pat

hrm…I guess there’s a problem with how Rails handles datetime’s in
PostgreSQL? Not sure. Anyway I did a search on how to convert a
DateTime to a Time (since DateTime doesn’t respond to #gmtime). Put
this code in lib/date_time.rb

class DateTime
def to_time
Time.mktime(year, mon, day, hour, min, sec)
end
end

required it in environment.rb, and changed the builder template code to
xml.pubDate CGI.rfc1123_date(@posts.first.created_on.to_time)

Works for me. If I’m doing something wrong, I’d like to know about
it, but I think it may just be a problem with Rails and postgres.

Pat