I’m currently testing in staging environment (heroku) where I have testers uploading imgs for their profiles using paperclip. However, whenever I do a git push to heroku to update the site (not changing the db), their pictures disappear. Does anyone know why this is happening and how I can get around this?
Here’s my configuration for paperclip:
has_attached_file :photo, :styles => {:thumb => "115x100#", :medium => "345x300#", :large => "690x600#"},
:path => ":rails_root/public/system/:attachment/:id/:style/:filename",
:url => "/system/:attachment/:id/:style/:filename"
production.rb config:
config.serve_static_assets = true
config.assets.compile = false
Thanks.
You shouldn’t use heroku’s filesystem that way. They intend for you to use S3 or some other durable storage medium. Heroku calls their filesystem an Ephemeral filesystem. Your application can write to it, but writes aren’t visible to other processes and if your dyno restarts all changes are lost.
Paperclip has good support for S3. Just have a look at their docs.