Fix missing body when migrating commentaire
This commit is contained in:
parent
9a7e57e0b5
commit
e4d9b7f960
1 changed files with 4 additions and 0 deletions
|
@ -19,6 +19,10 @@ namespace :'2017_10_30_copy_commentaire_piece_justificative_to_file' do
|
||||||
commentaire.file.define_singleton_method(:filename) { commentaire.piece_justificative.original_filename }
|
commentaire.file.define_singleton_method(:filename) { commentaire.piece_justificative.original_filename }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if commentaire.body.blank?
|
||||||
|
commentaire.body = commentaire.piece_justificative.original_filename || "."
|
||||||
|
end
|
||||||
|
|
||||||
commentaire.save
|
commentaire.save
|
||||||
if !commentaire.file.present?
|
if !commentaire.file.present?
|
||||||
puts "Failed to save file for commentaire #{commentaire.id}"
|
puts "Failed to save file for commentaire #{commentaire.id}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue