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
b19f897f
Commit
b19f897f
authored
Sep 13, 2016
by
Johnny Shields
Committed by
Tute Costa
Sep 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for proc arg for fog_public (#2302)
parent
8d08559e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
lib/paperclip/storage/fog.rb
+7
-4
spec/paperclip/storage/fog_spec.rb
+16
-0
No files found.
lib/paperclip/storage/fog.rb
View file @
b19f897f
...
...
@@ -86,11 +86,14 @@ module Paperclip
end
def
fog_public
(
style
=
default_style
)
if
@options
.
has_key?
(
:fog_public
)
if
@options
[
:fog_public
].
respond_to?
(
:has_key?
)
&&
@options
[
:fog_public
].
has_key?
(
style
)
@options
[
:fog_public
][
style
]
if
@options
.
key?
(
:fog_public
)
value
=
@options
[
:fog_public
]
if
value
.
respond_to?
(
:key?
)
&&
value
.
key?
(
style
)
value
[
style
]
elsif
value
.
respond_to?
(
:call
)
value
.
call
(
self
)
else
@options
[
:fog_public
]
value
end
else
true
...
...
spec/paperclip/storage/fog_spec.rb
View file @
b19f897f
...
...
@@ -273,6 +273,22 @@ describe Paperclip::Storage::Fog do
end
end
context
"with fog_public as a proc"
do
let
(
:proc
)
{
->
(
attachment
)
{
!
attachment
}
}
before
do
rebuild_model
(
@options
.
merge
(
fog_public:
proc
))
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
StringIO
.
new
(
"."
)
@dummy
.
save
end
it
"sets the @fog_public instance variable to false"
do
assert_equal
proc
,
@dummy
.
avatar
.
instance_variable_get
(
"@options"
)[
:fog_public
]
assert_equal
false
,
@dummy
.
avatar
.
fog_public
end
end
context
"with styles set and fog_public set to false"
do
before
do
rebuild_model
(
@options
.
merge
(
fog_public:
false
,
styles:
{
medium:
"300x300>"
,
thumb:
"100x100>"
}))
...
...
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