Commit 9050ecd5 by Prem Sichanugrist

Update the attachment's timestamp if the original file got reprocessed

Closes #170
parent e2add646
...@@ -263,6 +263,7 @@ module Paperclip ...@@ -263,6 +263,7 @@ module Paperclip
new_original.rewind new_original.rewind
@queued_for_write = { :original => new_original } @queued_for_write = { :original => new_original }
instance_write(:updated_at, Time.now)
post_process(*style_args) post_process(*style_args)
old_original.close if old_original.respond_to?(:close) old_original.close if old_original.respond_to?(:close)
......
...@@ -58,6 +58,7 @@ class IntegrationTest < Test::Unit::TestCase ...@@ -58,6 +58,7 @@ class IntegrationTest < Test::Unit::TestCase
has_attached_file :avatar, :styles => { :thumb => "150x25#", :dynamic => lambda { |a| '50x50#' } } has_attached_file :avatar, :styles => { :thumb => "150x25#", :dynamic => lambda { |a| '50x50#' } }
end end
@d2 = Dummy.find(@dummy.id) @d2 = Dummy.find(@dummy.id)
@original_timestamp = @d2.avatar_updated_at
@d2.avatar.reprocess! @d2.avatar.reprocess!
@d2.save @d2.save
end end
...@@ -66,6 +67,10 @@ class IntegrationTest < Test::Unit::TestCase ...@@ -66,6 +67,10 @@ class IntegrationTest < Test::Unit::TestCase
assert_match /\b150x25\b/, `identify "#{@dummy.avatar.path(:thumb)}"` assert_match /\b150x25\b/, `identify "#{@dummy.avatar.path(:thumb)}"`
assert_match /\b50x50\b/, `identify "#{@dummy.avatar.path(:dynamic)}"` assert_match /\b50x50\b/, `identify "#{@dummy.avatar.path(:dynamic)}"`
end end
should "change the timestamp" do
assert_not_equal @original_timestamp, @d2.avatar_updated_at
end
end end
end end
......
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