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
6c912c4d
Commit
6c912c4d
authored
Aug 24, 2011
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes an infinite interpolation problem with fog
parent
3f56e703
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
lib/paperclip/storage/fog.rb
+3
-0
test/fog_test.rb
+20
-0
No files found.
lib/paperclip/storage/fog.rb
View file @
6c912c4d
...
...
@@ -47,7 +47,10 @@ module Paperclip
@fog_public
=
@options
.
key?
(
:fog_public
)
?
@options
[:
fog_public
]
:
true
@fog_file
=
@options
[
:fog_file
]
||
{}
unless
@url
.
to_s
.
match
(
/^:fog.*url$/
)
@path
=
@path
.
gsub
(
/:url/
,
@url
)
@url
=
':fog_public_url'
end
Paperclip
.
interpolates
(
:fog_public_url
)
do
|
attachment
,
style
|
attachment
.
public_url
(
style
)
end
unless
Paperclip
::
Interpolations
.
respond_to?
:fog_public_url
...
...
test/fog_test.rb
View file @
6c912c4d
...
...
@@ -5,6 +5,26 @@ Fog.mock!
class
FogTest
<
Test
::
Unit
::
TestCase
context
""
do
context
"with default values for path and url"
do
setup
do
rebuild_model
:styles
=>
{
:medium
=>
"300x300>"
,
:thumb
=>
"100x100>"
},
:storage
=>
:fog
,
:url
=>
'/:attachment/:filename'
,
:fog_directory
=>
"paperclip"
,
:fog_credentials
=>
{
:provider
=>
'AWS'
,
:aws_access_key_id
=>
'AWS_ID'
,
:aws_secret_access_key
=>
'AWS_SECRET'
}
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'fixtures'
,
'5k.png'
),
'rb'
)
end
should
"be able to interpolate the path without blowing up"
do
puts
@dummy
.
avatar
.
instance_variable_get
(
"@path"
)
assert_equal
File
.
join
(
File
.
dirname
(
File
.
expand_path
(
__FILE__
)),
"../public/avatars/5k.png"
),
@dummy
.
avatar
.
path
end
end
setup
do
@fog_directory
=
'papercliptests'
...
...
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