Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix 293, 601: STI subclassing overwrites options

Problem: When using STI, and when 'config.cache_classes = true', then
the STI subclass that gets loaded last will overwrite the options for
the others. This is due to using Rails class_attribute with a mutable
hash.

Solution: dup the hash.
  • Loading branch information...
commit 2c6b7cb06a016ef147511a10303d207181022e32 1 parent 9edeb01
@ramn authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  lib/paperclip.rb
View
2  lib/paperclip.rb
@@ -314,6 +314,8 @@ def has_attached_file name, options = {}
else
write_inheritable_attribute(:attachment_definitions, {})
end
+ else
+ self.attachment_definitions = self.attachment_definitions.dup
end
attachment_definitions[name] = {:validations => []}.merge(options)
Please sign in to comment.
Something went wrong with that request. Please try again.