You've to create the old activities manually using create_activity
method. I created a rake task for this.
task public_activity_migration: :environment do
User.find_each do |user|
[:comments, :friends].each do |relation|
user.send(relation).find_each do |obj|
obj.create_activity :create, owner: user, created_at: obj.created_at
print "."
end
end
end
end
The code above will create activities for the comment and friend model. If you're not using strong params you also need to allow the created_at
attribute to be set on the PublicActivity::Activity
model. This can be done by adding the following code before running your task.
class PublicActivity::Activity
attr_accessible :created_at
end