Nicolae Claudius
11 years ago
3 changed files with 23 additions and 10 deletions
@ -0,0 +1,11 @@ |
|||||||
|
desc "Data migrations" |
||||||
|
namespace :data do |
||||||
|
task :versions_sync => :environment do |
||||||
|
PaperTrail::Version.where.not(object: nil).find_each do |version| |
||||||
|
if !version.creator_id? && !version.updator_id? && (object = version.reify) && |
||||||
|
object.respond_to?(:creator_id) && object.respond_to?(:updator_id) |
||||||
|
version.update(creator_id: object.creator_id, updator_id: object.updator_id) |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue