Namespace conflict #675

Closed
FUT opened this Issue Dec 13, 2011 · 4 comments

Comments

Projects
None yet
3 participants
Contributor

sikachu commented Dec 13, 2011

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.

FUT commented Dec 13, 2011

Thank you I'll try. Tomorrow I'll write here the result. :)

FUT commented Dec 14, 2011

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?

Member

jyurek commented Dec 14, 2011

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.

jyurek closed this Dec 14, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment