Skip to content

Commit

Permalink
Handle protected attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
thedarkone committed Jan 17, 2009
1 parent d01bdc1 commit 1f63051
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/paperclip.rb
Expand Up @@ -299,7 +299,9 @@ def rename_attached_files
# but nothing has been done to the attachment itself (i.e. it is 'clean') and we only need to rename the files
unless (my_changes = changes).empty? || (clean_attachments = unchaned_attachments).empty?
# how the instance looked before
old_instance = self.class.new(attributes.merge!(_old_attributes_hash(my_changes)))
old_instance = self.class.new
# get around protected attributes
old_instance.send(:attributes=, attributes.merge!(_old_attributes_hash(my_changes)), false)
clean_attachments.each do |attachment|
attachment.send(:queue_existing_for_rename, old_instance)
attachment.send(:flush_renames)
Expand Down

0 comments on commit 1f63051

Please sign in to comment.