L
L
lavezzi12015-08-26 13:38:57
Ruby on Rails
lavezzi1, 2015-08-26 13:38:57

How do thumbnails work in paperclip gem?

Hello.
I use paperclip for avatars, it works ok. But now there was a problem with adding a new size for the thumbnail, I needed to display a very small size avatars on a separate page, for this I added the following code to the user model

has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "160x160#", :small => "80x80" }, :default_url => "/images/:style/missing.png"

As a result, users who already had avatars simply have nothing, such as the file was not found. But if you put the avatar again, the picture is generated for all sizes.
If during the operation of the service, in production, I want to change the size of the avatar to a larger one, then all users will have to change the avatars. Is not cool. How to solve it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
N. Bekseitov, 2015-08-26
@lavezzi1

rake paperclip:refresh CLASS=Avatar

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question