Commit 9a9c9ab7 by printercu Committed by Jon Yurek

mark instance as changed after assigning new file

parent dcd2774e
......@@ -110,6 +110,8 @@ module Paperclip
# Reset the file size if the original file was reprocessed.
instance_write(:file_size, @queued_for_write[:original].size)
instance_write(:fingerprint, @queued_for_write[:original].fingerprint) if instance_respond_to?(:fingerprint)
updater = :"#{name}_file_name_will_change!"
instance.send updater if instance.respond_to? updater
end
# Returns the public URL of the attachment with a given style. This does
......
......@@ -1207,6 +1207,13 @@ class AttachmentTest < Test::Unit::TestCase
assert_equal creation.to_i, @dummy.avatar.created_at
assert_not_equal now.to_i, @dummy.avatar.created_at
end
should "set changed? to true on attachment assignment" do
@dummy.avatar = @file
@dummy.save!
@dummy.avatar = @file
assert @dummy.changed?
end
end
context "and avatar_updated_at column" do
......
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