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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
9 deletions
+2
-9
lib/paperclip/interpolations.rb
+1
-1
spec/paperclip/interpolations_spec.rb
+1
-8
No files found.
lib/paperclip/interpolations.rb
View file @
a7675950
...
@@ -172,7 +172,7 @@ module Paperclip
...
@@ -172,7 +172,7 @@ module Paperclip
when
Integer
when
Integer
(
"%09d"
%
id
).
scan
(
/\d{3}/
).
join
(
"/"
)
(
"%09d"
%
id
).
scan
(
/\d{3}/
).
join
(
"/"
)
when
String
when
String
(
'%9.9s'
%
id
).
tr
(
" "
,
"0"
).
scan
(
/.{3}/
).
join
(
"/"
)
id
.
scan
(
/.{3}/
).
first
(
3
).
join
(
"/"
)
else
else
nil
nil
end
end
...
...
spec/paperclip/interpolations_spec.rb
View file @
a7675950
...
@@ -138,14 +138,7 @@ describe Paperclip::Interpolations do
...
@@ -138,14 +138,7 @@ describe Paperclip::Interpolations do
assert_equal
"000/000/023"
,
Paperclip
::
Interpolations
.
id_partition
(
attachment
,
:style
)
assert_equal
"000/000/023"
,
Paperclip
::
Interpolations
.
id_partition
(
attachment
,
:style
)
end
end
it
"returns the partitioned id of the attachment when the id is a short string"
do
it
"returns the partitioned id of the attachment when the id is a 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
attachment
=
mock
attachment
=
mock
attachment
.
expects
(
:id
).
returns
(
"32fnj23oio2f"
)
attachment
.
expects
(
:id
).
returns
(
"32fnj23oio2f"
)
attachment
.
expects
(
:instance
).
returns
(
attachment
)
attachment
.
expects
(
:instance
).
returns
(
attachment
)
...
...
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