Merge pull request #998 from sgmap/fix_task_for_missing_pj
If pj is missing do not crash
This commit is contained in:
commit
9a7e57e0b5
1 changed files with 10 additions and 8 deletions
|
@ -11,6 +11,7 @@ namespace :'2017_10_30_copy_commentaire_piece_justificative_to_file' do
|
||||||
|
|
||||||
def process_commentaire commentaire
|
def process_commentaire commentaire
|
||||||
puts "Processing commentaire #{commentaire.id}"
|
puts "Processing commentaire #{commentaire.id}"
|
||||||
|
if commentaire.piece_justificative.present?
|
||||||
# https://github.com/carrierwaveuploader/carrierwave#uploading-files-from-a-remote-location
|
# https://github.com/carrierwaveuploader/carrierwave#uploading-files-from-a-remote-location
|
||||||
commentaire.remote_file_url = commentaire.piece_justificative.content_url
|
commentaire.remote_file_url = commentaire.piece_justificative.content_url
|
||||||
|
|
||||||
|
@ -23,4 +24,5 @@ namespace :'2017_10_30_copy_commentaire_piece_justificative_to_file' do
|
||||||
puts "Failed to save file for commentaire #{commentaire.id}"
|
puts "Failed to save file for commentaire #{commentaire.id}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue