Permalink
Browse files

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

Closes #170
  • Loading branch information...
1 parent e2add64 commit 9050ecd512e2819ccfb805ae347f7e54a4dc2932 @sikachu sikachu committed Jun 30, 2011
Showing with 6 additions and 0 deletions.
  1. +1 −0 lib/paperclip/attachment.rb
  2. +5 −0 test/integration_test.rb
@@ -263,6 +263,7 @@ def reprocess!(*style_args)
new_original.rewind
@queued_for_write = { :original => new_original }
+ instance_write(:updated_at, Time.now)
post_process(*style_args)
old_original.close if old_original.respond_to?(:close)
View
@@ -58,6 +58,7 @@ class IntegrationTest < Test::Unit::TestCase
has_attached_file :avatar, :styles => { :thumb => "150x25#", :dynamic => lambda { |a| '50x50#' } }
end
@d2 = Dummy.find(@dummy.id)
+ @original_timestamp = @d2.avatar_updated_at
@d2.avatar.reprocess!
@d2.save
end
@@ -66,6 +67,10 @@ class IntegrationTest < Test::Unit::TestCase
assert_match /\b150x25\b/, `identify "#{@dummy.avatar.path(:thumb)}"`
assert_match /\b50x50\b/, `identify "#{@dummy.avatar.path(:dynamic)}"`
end
+
+ should "change the timestamp" do
+ assert_not_equal @original_timestamp, @d2.avatar_updated_at
+ end
end
end

0 comments on commit 9050ecd

Please sign in to comment.