upload_sanitizer.rb 293 Bytes Edit Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 module UploadSanitizer def self.included(base) base.extend(ClassMethods) end module ClassMethods def sanitize_filename before_create { |file| file.filename = Environment.verify_filename(file.filename) } end end end ActiveRecord::Base.send :include, UploadSanitizer