Trying to set the created_at date manually:
entry = Entry.new
entry.text = tweet['text']
entry.source = 'tweet'
entry.user_id = user.id
entry.latitude = coords[1]
entry.longitude = coords[0]
entry.created_at = Chromium(tweet.created_at)
Getting the following error:
undefined method `created_at' for #<Hash:0x1036af910>
How can I avoid this? I would like to keep created_at’s default functionality as not all entries are entered in this way.
Your problem isn’t with the created_at method of the ActiveRecord object.
I think what’s spitting the error here is actually the
created_atmethod being called on yourtweetobject.See above – you use
(
tweetis a hash)… but thencomplains that the Hash doesn’t have a method called
created_at