Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
d4f43139
Commit
d4f43139
authored
Jul 18, 2013
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation for filename_cleaner
parent
7fee0b1a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
lib/paperclip/attachment.rb
+4
-0
No files found.
lib/paperclip/attachment.rb
View file @
d4f43139
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment