на основе комментария iGian я получил этот код:
before_save :strip_exif_data
private
def strip_exif_data
return unless image.attached?
filename = image.filename.to_s
attachment_path = "#{Dir.tmpdir}/#{image.filename}"
File.open(attachment_path, 'wb') do |file|
file.write(image.download)
file.close
end
mm_image = MiniMagick::Image.open(attachment_path)
mm_image.strip
mm_image.write attachment_path
image.attach(io: File.open(attachment_path), filename: filename)
end