Question

I'm using paperclip by thoughtbot for attachments to models and everything works fine on my development machine running mac os x and mongrel. However when I deploy may app to a debian machine running apache/mod_rails (2.2.5) I can't get it started. I get 'undefined method has_attached_file' (or 'uninitialized constant Paperclip' using an initializer). I'm sure there is an easy solution but I appear to be blind... Any hints? Thanks!

Was it helpful?

Solution

I would suggest just 'vendoring' your gems. Just require the gems you use in your environment.rb file using config.gem syntax (you can search online for more specific instructions) and then once those entries are in there, just run 'rake gems:unpack' and the gems you have installed that are required for the app (via the config.gem entries) will be put in vendor/gems.

This way your app will always know where to find your gems...

OTHER TIPS

Make sure you have this gem properly installed on target machine. If you used REE when installing Passenger then you need to install gems with gem-e instead of gem. In short:

sudo gem-e install paperclip

Blind was right! I finally solved the issue by specifying the paperclip gem thru the proper config.gem entry in environment.rb. I maintain two different environment.rb files, one for development, the other for the production server and I forgot to add the paperclip config.gem line to the latter... Too bad, sorry for bothering you and thanks heaps for answering! Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top