Skip to content

Instantly share code, notes, and snippets.

@rjswenson
Created March 2, 2015 18:55
Show Gist options
  • Save rjswenson/903df6abe447254fd08a to your computer and use it in GitHub Desktop.
Save rjswenson/903df6abe447254fd08a to your computer and use it in GitHub Desktop.
Paperclip.interpolates :altered_image_filename do |attachment, style|
# The change is at the very end here
attachment.instance.original_filename.match(/([A-Za-z0-9]+_)?[A-Za-z0-9]+_[a-zA-Z0-9]+_[PSA](_[0-9]+)?/).to_s + ".png"
end
#^~~~~~~~~^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment