Sha256: 8a0f90044e7e33bac5edb00901fa6ff4e56dbfb7f96211e8c0bfee1bf48bf9db

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 Bytes

Contents

# We will replace every underscores (_) in the filename for a hyphen (-)
# This must be done in a patch because Paperclip has hardcoded that all :restricted_characters
# will be replaced by an underscore in the FilenameCleaner class: https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/filename_cleaner.rb
# For this reason, we can't add the underscore char to the :restricted_characters config.

module Paperclip
  class FilenameCleaner
    def call(filename)
      filename = filename.parameterize

      if @invalid_character_regex
        filename = filename.gsub(@invalid_character_regex, "_").gsub("_", "-")
      else
        filename
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_admin_image_manager-0.1.21 lib/paperclip_patch.rb