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
2b562a9b
Commit
2b562a9b
authored
Jan 19, 2012
by
Benjamin Hüttinger
Committed by
Benjamin Hüttinger
Jan 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow proc for fog_host
parent
e049ec53
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletions
+20
-1
lib/paperclip/storage/fog.rb
+6
-1
test/storage/fog_test.rb
+14
-0
No files found.
lib/paperclip/storage/fog.rb
View file @
2b562a9b
...
...
@@ -126,7 +126,12 @@ module Paperclip
def
public_url
(
style
=
default_style
)
if
@options
[
:fog_host
]
host
=
(
@options
[
:fog_host
]
=~
/%d/
)
?
@options
[:
fog_host
]
%
(
path
(
style
).
hash
%
4
)
:
@options
[
:fog_host
]
host
=
if
@options
[
:fog_host
].
is_a?
(
Proc
)
@options
[
:fog_host
].
call
(
self
)
else
(
@options
[
:fog_host
]
=~
/%d/
)
?
@options
[:
fog_host
]
%
(
path
(
style
).
hash
%
4
)
:
@options
[
:fog_host
]
end
"
#{
host
}
/
#{
path
(
style
)
}
"
else
if
fog_credentials
[
:provider
]
==
'AWS'
...
...
test/storage/fog_test.rb
View file @
2b562a9b
...
...
@@ -235,6 +235,20 @@ class FogTest < Test::Unit::TestCase
end
end
context
"with a proc for the fog_host evaluating a model method"
do
setup
do
rebuild_model
(
@options
.
merge
(
:fog_host
=>
lambda
{
|
attachment
|
attachment
.
instance
.
fog_host
}))
@dummy
=
Dummy
.
new
@dummy
.
stubs
(
:fog_host
).
returns
(
'http://dynamicfoghost.com'
)
@dummy
.
avatar
=
@file
@dummy
.
save
end
should
"provide a public url"
do
assert_match
/http:\/\/dynamicfoghost\.com/
,
@dummy
.
avatar
.
url
end
end
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