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
a7675950
Commit
a7675950
authored
Dec 19, 2014
by
Oliver Heard
Committed by
Jon Yurek
Dec 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Make id partitioning for string similar to integer"
This reverts commit
06802254
.
parent
79d42b62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
10 deletions
+3
-10
lib/paperclip/interpolations.rb
+1
-1
spec/paperclip/interpolations_spec.rb
+2
-9
No files found.
lib/paperclip/interpolations.rb
View file @
a7675950
...
...
@@ -172,7 +172,7 @@ module Paperclip
when
Integer
(
"%09d"
%
id
).
scan
(
/\d{3}/
).
join
(
"/"
)
when
String
(
'%9.9s'
%
id
).
tr
(
" "
,
"0"
).
scan
(
/.{3}/
).
join
(
"/"
)
id
.
scan
(
/.{3}/
).
first
(
3
).
join
(
"/"
)
else
nil
end
...
...
spec/paperclip/interpolations_spec.rb
View file @
a7675950
...
...
@@ -138,14 +138,7 @@ describe Paperclip::Interpolations do
assert_equal
"000/000/023"
,
Paperclip
::
Interpolations
.
id_partition
(
attachment
,
:style
)
end
it
"returns the partitioned id of the attachment when the id is a short string"
do
attachment
=
mock
attachment
.
expects
(
:id
).
returns
(
"fnj23"
)
attachment
.
expects
(
:instance
).
returns
(
attachment
)
assert_equal
"000/0fn/j23"
,
Paperclip
::
Interpolations
.
id_partition
(
attachment
,
:style
)
end
it
"returns the partitioned id of the attachment when the id is a long string"
do
it
"returns the partitioned id of the attachment when the id is a string"
do
attachment
=
mock
attachment
.
expects
(
:id
).
returns
(
"32fnj23oio2f"
)
attachment
.
expects
(
:instance
).
returns
(
attachment
)
...
...
@@ -211,7 +204,7 @@ describe Paperclip::Interpolations do
attachment
.
stubs
(
:original_filename
).
returns
(
"one"
)
assert_equal
"one"
,
Paperclip
::
Interpolations
.
filename
(
attachment
,
:style
)
end
it
"returns the basename when the extension contains regexp special characters"
do
attachment
=
mock
attachment
.
stubs
(
:styles
).
returns
({})
...
...
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