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
f0cd9ea4
Commit
f0cd9ea4
authored
Apr 23, 2008
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed interpolations to run longer-named ones first, preventing collisions.
parent
87bd86cc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
lib/paperclip/attachment.rb
+5
-5
test/test_attachment.rb
+1
-1
No files found.
lib/paperclip/attachment.rb
View file @
f0cd9ea4
...
...
@@ -198,13 +198,13 @@ module Paperclip
end
def
interpolate
pattern
,
style
=
default_style
#:nodoc:
pattern
=
pattern
.
dup
self
.
class
.
interpolations
.
each
do
|
tag
,
l
|
pattern
.
gsub!
(
/:\b
#{
tag
}
\b/
)
do
|
match
|
l
.
call
(
self
,
style
)
interpolations
=
self
.
class
.
interpolations
.
sort
{
|
a
,
b
|
a
.
first
.
to_s
<=>
b
.
first
.
to_s
}
interpolations
.
reverse
.
inject
(
pattern
.
dup
)
do
|
result
,
interpolation
|
tag
,
blk
=
interpolation
result
.
gsub
(
/:
#{
tag
}
/
)
do
|
match
|
blk
.
call
(
self
,
style
)
end
end
pattern
end
def
queue_existing_for_delete
#:nodoc:
...
...
test/test_attachment.rb
View file @
f0cd9ea4
...
...
@@ -82,7 +82,7 @@ class AttachmentTest < Test::Unit::TestCase
end
should
"make sure that they are interpolated correctly"
do
assert_equal
"1024.omg/1024-bbq/
:id
what/000/001/024.wtf"
,
@dummy
.
avatar
.
path
assert_equal
"1024.omg/1024-bbq/
1024
what/000/001/024.wtf"
,
@dummy
.
avatar
.
path
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