The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

18 lines
377 B

  1. # frozen_string_literal: true
  2. module ObfuscateFilename
  3. extend ActiveSupport::Concern
  4. class_methods do
  5. def obfuscate_filename(*args)
  6. before_action { obfuscate_filename(*args) }
  7. end
  8. end
  9. def obfuscate_filename(path)
  10. file = params.dig(*path)
  11. return if file.nil?
  12. file.original_filename = 'media' + File.extname(file.original_filename)
  13. end
  14. end