Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Should it be possible to copy empty attachments between instances? #947

Closed
tamc opened this issue Jul 3, 2012 · 2 comments
Closed

Should it be possible to copy empty attachments between instances? #947

tamc opened this issue Jul 3, 2012 · 2 comments
Assignees
Labels
Milestone

Comments

@tamc
Copy link
Contributor

tamc commented Jul 3, 2012

I expected the following to work:

class Thing < ActiveRecord::Base
  has_attached_file :file
end

original = Thing.create
copy = Thing.new
copy.file = original.file
copy.save

Minimum code to turn this into a working example here: https://gist.github.com/3037822

However, it doesn't, it throws:

paperclip-3.1.2/lib/paperclip/tempfile_factory.rb:14:in `extname': can't convert nil into String (TypeError)

Before I write a test and propose a patch, I just wanted to check that everyone agrees that this is a bug and not deliberate in some way that I'm too dense to spot.

Thanks

Tom

@jyurek
Copy link

jyurek commented Jul 3, 2012

Yes, this is something that should work in Paperclip. If you want to write a fix, it would be greatly appreciated.

@sikachu
Copy link
Contributor

sikachu commented Jul 4, 2012

Wait @jyurek , is this something that should work in AttachmentAdapter?

@ghost ghost assigned jyurek Jul 4, 2012
tamc added a commit to tamc/paperclip that referenced this issue Jul 4, 2012
tamc added a commit to tamc/paperclip that referenced this issue Jul 4, 2012
tamc added a commit to tamc/paperclip that referenced this issue Jul 10, 2012
sikachu pushed a commit that referenced this issue Jul 13, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants