I have rather weird problem with paperclip gem. You know it defines Attachment class inside itself. So the model with exactly the same name already exists in my project. As the result in some parts of the code i cant get access to my previous Attachment model.
I tried to write full name of my model class, but the result was very interesting (in console):
ActiveRecord::Base::Attachment
=> Paperclip::Attachment
I can get access to my Attachment model inside AttachmentController and by default it console but nowhere else.
Also i tried to create simple object from console without attached file.
a.errors.sort
[]
a.save
TypeError: can't dump anonymous class Class
As you see object a has no errors but throws error in save.
Finally my aim is to copy a collection of Attachment objects from one holder-object to another. I mean deep copy, so files should be copied too. If you have any suggestions about these points I’ll appreciate.
You can always access your class via “::Attachment”, but make sure you’re using the latest version of Paperclip. There were some namespace collision bugs that were fixed.