2
votes

I am using Paperclip for uploading the Profile image in my application (rails)

My User model is having a

 has_attached_file :avatar,
   :url => "/:attachment/:id/:style/:basename.:extension",
   :path => ":rails_root/public/:attachment/:id/:style/:basename.:extension",
   :styles => { :medium => "300x300>", :small => "100x100>", :thumb => "50x50>", :micro => "30x30>" }

In my VIew If i have a profile image uploaded then its pointing correctly as

/avatars/1/thumb/iamge

BUt if the image is not there if they didn't uploaded in that case its pointing as

/avatars/thumb/missing.png which doesn't have any image.

Please give suggestions what to do if the user didnt uploaded any profile image..

1
Do you have an image for /avatars/thumb/missing.png? This would be Paperclip's way of displaying a default image if the user didn't upload one.Wukerplank
Possible duplicate of Rails missing imageKick Buttowski

1 Answers

3
votes

You can make a default image and put it there and name it missing.png. It is like extra functionality :)