Commit 2c6b7cb0 by ramn

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.
parent 9edeb014
...@@ -314,6 +314,8 @@ module Paperclip ...@@ -314,6 +314,8 @@ module Paperclip
else else
write_inheritable_attribute(:attachment_definitions, {}) write_inheritable_attribute(:attachment_definitions, {})
end end
else
self.attachment_definitions = self.attachment_definitions.dup
end end
attachment_definitions[name] = {:validations => []}.merge(options) attachment_definitions[name] = {:validations => []}.merge(options)
......
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