Commit a7675950 by Oliver Heard Committed by Jon Yurek

Revert "Make id partitioning for string similar to integer"

This reverts commit 06802254.
parent 79d42b62
...@@ -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
......
...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment