lib/bulldog/has_attachment.rb in bulldog-0.2.3 vs lib/bulldog/has_attachment.rb in bulldog-0.2.4
- old
+ new
@@ -11,12 +11,14 @@
include InstanceMethods
end
reflection = attachment_reflections[name] || Reflection.new(self, name)
reflection.configure(&block)
- attachment_reflections[name] = reflection
- define_attachment_accessors(reflection.name)
- define_attachment_attribute_methods(reflection.name)
+ unless attachment_reflections.key?(name)
+ attachment_reflections[name] = reflection
+ define_attachment_accessors(reflection.name)
+ define_attachment_attribute_methods(reflection.name)
+ end
end
module InstanceMethods
def self.included(base)
base.instance_variable_set(:@attachment_reflections, {})