Check it here:
To access your model, use ::Attachment. Your model doesn't have a namespace.
I had a project which uses Attachment as a model name as well, and that's working fine for me.
Thank you I'll try. Tomorrow I'll write here the result. :)
Yeah, It does work! Thank you for your help! But I can't understand why paperclip doesn't insert it's classes in another module (e.g. Paperclip) to prevent such kind of conflicts. Is it any reason?
I've answered this on StackOverflow, too. But to answer your specific question, Paperclip used to "include Paperclip" in ActiveRecord::Base, which caused this problem. In a later fix (which is why i ask in th SO thread if you have the latest version), Paperclip puts all the necessary stuff in Paperclip::Glue, which has no sub-constants that can interfere. So, if you have the latest version, you shouldn't see any problems with namespace collisions. If you do, I'd certainly love to hear more about them so they can be fixed.