0
votes

I am using paperclip with S3 to save my users images in an amazon bucket. The working version used to save images in s3.amazonaws.com/my-bucket/users/photos/000/000/1/small/photo.jpg. When I created Male and Female models (subclasses of User) it started to search images in s3.amazonaws.com/my-bucket/males/photos/000/000/1/small/photo.jpg (if the user is a male).

Furthermore, when I try to create a new photo I got a nginx 500 Internal Server Error and have no log in rails application.

How should I solve that?

1

1 Answers

1
votes

I had the same issue sometime ago and it worked for me just to restart my web server. I was using Passenger in my application.

I forgot to mention that I created an interpolation with Paperclip method Interpolates, just like that:

#config/initializers/paperclip.rb
Paperclip.interpolates :class  do |attachment, style|
  attachment.instance.class.model_name.downcase.pluralize
end

Now the files url at S3 will make use of .../users/..., not .../males/... or .../females/... anymore.