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
eb466fac
Commit
eb466fac
authored
Nov 02, 2012
by
djcp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation for new :override_file_permissions option
parent
331ae182
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
lib/paperclip/storage/filesystem.rb
+8
-2
No files found.
lib/paperclip/storage/filesystem.rb
View file @
eb466fac
...
@@ -3,7 +3,7 @@ module Paperclip
...
@@ -3,7 +3,7 @@ module Paperclip
# The default place to store attachments is in the filesystem. Files on the local
# The default place to store attachments is in the filesystem. Files on the local
# filesystem can be very easily served by Apache without requiring a hit to your app.
# filesystem can be very easily served by Apache without requiring a hit to your app.
# They also can be processed more easily after they've been saved, as they're just
# They also can be processed more easily after they've been saved, as they're just
# normal files. There
is one Filesystem-specific option for has_attached_file.
# normal files. There
are two Filesystem-specific options for has_attached_file:
# * +path+: The location of the repository of attachments on disk. This can (and, in
# * +path+: The location of the repository of attachments on disk. This can (and, in
# almost all cases, should) be coordinated with the value of the +url+ option to
# almost all cases, should) be coordinated with the value of the +url+ option to
# allow files to be saved into a place where Apache can serve them without
# allow files to be saved into a place where Apache can serve them without
...
@@ -15,6 +15,12 @@ module Paperclip
...
@@ -15,6 +15,12 @@ module Paperclip
# public directory.
# public directory.
# See Paperclip::Attachment#interpolate for more information on variable interpolaton.
# See Paperclip::Attachment#interpolate for more information on variable interpolaton.
# :path => "/var/app/attachments/:class/:id/:style/:basename.:extension"
# :path => "/var/app/attachments/:class/:id/:style/:basename.:extension"
# * +override_file_permissions+: This allows you to override the file permissions for files
# saved by paperclip. If you set this to an explicit octal value (0755, 0644, etc) then
# that value will be used to set the permissions for an uploaded file. The default is 0666.
# If you set :override_file_permissions to false, the chmod will be skipped. This allows
# you to use paperclip on filesystems that don't understand unix file permissions, and has the
# added benefit of using the storage directories default umask on those that do.
module
Filesystem
module
Filesystem
def
self
.
extended
base
def
self
.
extended
base
end
end
...
@@ -36,7 +42,7 @@ module Paperclip
...
@@ -36,7 +42,7 @@ module Paperclip
end
end
end
end
unless
@options
[
:override_file_permissions
]
==
false
unless
@options
[
:override_file_permissions
]
==
false
resolved_chmod
=
(
@options
[
:override_file_permissions
]
&~
0111
)
||
(
0666
&~
File
.
umask
)
resolved_chmod
=
(
@options
[
:override_file_permissions
]
&~
0111
)
||
(
0666
&~
File
.
umask
)
FileUtils
.
chmod
(
resolved_chmod
,
path
(
style_name
)
)
FileUtils
.
chmod
(
resolved_chmod
,
path
(
style_name
)
)
end
end
file
.
rewind
file
.
rewind
...
...
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