Skip to content

Instantly share code, notes, and snippets.

@dce
Created May 26, 2009 11:46
Show Gist options
  • Save dce/118021 to your computer and use it in GitHub Desktop.
Save dce/118021 to your computer and use it in GitHub Desktop.
Activity.record_timestamps = false
Post.all.each do |post|
if post.published?
post.create_activity(:updated_at => post.updated_at)
end
end
Comment.all.each do |comment|
obj = comment.commentable
if !obj.respond_to?(:published?) or obj.published?
if obj.activity
obj.activity.update_attributes(:updated_at => comment.created_at)
else
obj.create_activity(:updated_at => comment.created_at)
end
end
end
Activity.record_timestamps = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment