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
On 4/2/06, Pat Maddox <pergesu@gmail.com> wrote:> 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
>