Skip to content

Commit

Permalink
reprocess! only when needed, since it's cost invalidate the copy purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Eduardo Rodrigues Diógenes committed Feb 1, 2015
1 parent 96a3bc9 commit 7bac049
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/s3-upnow/paperclip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ def has_attached_file(name, options = {})
dest_bucket = s3.buckets[s3_upnow_destination_bucket(name)]
dest_object = dest_bucket.objects[s3_upnow_destination_path(name)]
dest_object.copy_from(orig_object, acl: s3_upnow_destination_permissions(name))
remove_instance_variable("@#{name}_s3_key")
s3_upnow_attachment(name).reprocess!
if s3_upnow_attachment(name).styles.present?
remove_instance_variable("@#{name}_s3_key")
s3_upnow_attachment(name).reprocess!
end
end
end
super(name, options)
Expand Down

0 comments on commit 7bac049

Please sign in to comment.