Commit e8f45902 by Jon Yurek

#43 Applied patch to avoid instance variable conflict.

parent 4c64f655
......@@ -232,8 +232,8 @@ module Paperclip
module InstanceMethods #:nodoc:
def attachment_for name
@attachments ||= {}
@attachments[name] ||= Attachment.new(name, self, self.class.attachment_definitions[name])
@_paperclip_attachments ||= {}
@_paperclip_attachments[name] ||= Attachment.new(name, self, self.class.attachment_definitions[name])
end
def each_attachment
......
......@@ -263,6 +263,25 @@ class IntegrationTest < Test::Unit::TestCase
end
context "A model with an attachments association and a Paperclip attachment" do
setup do
Dummy.class_eval do
has_many :attachments, :class_name => 'Dummy'
end
@dummy = Dummy.new
@dummy.avatar = File.new(File.join(File.dirname(__FILE__),
"fixtures",
"5k.png"), 'rb')
end
should "should not error when saving" do
assert_nothing_raised do
@dummy.save!
end
end
end
if ENV['S3_TEST_BUCKET']
def s3_files_for attachment
[:thumb, :medium, :large, :original].inject({}) do |files, style|
......
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