Question

I'm using Feedzirra to parse feed, and the method for creating entries is like

class Feed < ActiveRecord::Base

def create_entries rawfeed
   self.entries.create(title: rawfeed.title, content:rawfeed.content, published:rawfeed.published, 
                 url: rawfeed.url, guid: rawfeed.id)
end

It works fine except the created entry's "published" time is really wired: something like

2000-01-01 17:26:15 UTC 

I check the entry I passed to the create method, it looks fine. So I just have no idea what goes wrong. Other attributes are all normal, including the "created_at" attribute. Anyone has suggestion? Thanks very much.

Was it helpful?

Solution

I met the same problem with mysql.

Your Entry's 'published' field is defined as :time? Look migration file for Entry, such as db/migrate/XXXXX_create_entries.rb

After changing :time to :datetime, everything goes fine.

Please try this solution.

P.S.

In development env, the problem does not happen. I think SQLite differ in the way to handle the field :time from the way of MySQL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top