Commit d4f43139 by Jon Yurek

Documentation for filename_cleaner

parent 7fee0b1a
...@@ -61,6 +61,7 @@ module Paperclip ...@@ -61,6 +61,7 @@ module Paperclip
# +source_file_options+ - flags passed to the +convert+ command that controls how the file is read # +source_file_options+ - flags passed to the +convert+ command that controls how the file is read
# +processors+ - classes that transform the attachment. Defaults to [:thumbnail] # +processors+ - classes that transform the attachment. Defaults to [:thumbnail]
# +preserve_files+ - whether to keep files on the filesystem when deleting or clearing the attachment. Defaults to false # +preserve_files+ - whether to keep files on the filesystem when deleting or clearing the attachment. Defaults to false
# +filename_cleaner+ - An object that responds to #call(filename) that will strip unacceptable charcters from filename
# +interpolator+ - the object used to interpolate filenames and URLs. Defaults to Paperclip::Interpolations # +interpolator+ - the object used to interpolate filenames and URLs. Defaults to Paperclip::Interpolations
# +url_generator+ - the object used to generate URLs, using the interpolator. Defaults to Paperclip::UrlGenerator # +url_generator+ - the object used to generate URLs, using the interpolator. Defaults to Paperclip::UrlGenerator
# +escape_url+ - Perform URI escaping to URLs. Defaults to true # +escape_url+ - Perform URI escaping to URLs. Defaults to true
...@@ -481,6 +482,9 @@ module Paperclip ...@@ -481,6 +482,9 @@ module Paperclip
end end
end end
# You can either specifiy :restricted_characters or you can define your own
# :filename_cleaner object. This object needs to respond to #call and takes
# the filename that will be cleaned. It should return the cleaned filenme.
def filename_cleaner def filename_cleaner
@options[:filename_cleaner] || FilenameCleaner.new(@options[:restricted_characters]) @options[:filename_cleaner] || FilenameCleaner.new(@options[:restricted_characters])
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment