Skip to content

Instantly share code, notes, and snippets.

@ktopping
Created May 23, 2012 15:28
Show Gist options
  • Save ktopping/2775902 to your computer and use it in GitHub Desktop.
Save ktopping/2775902 to your computer and use it in GitHub Desktop.
gen md5 hash
# note the caller ensures that "prefix" consists of something
# uniquely identifying the user/brochure combination
def images_key(images, prefix = "")
key = "#{prefix} "
images.each do |im|
key += "#{im.file.size} #{im.file_updated_at}"
end
Digest::MD5.new.hexdigest(key)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment