Web Development

We all make mistakes. It’s not hard to make a mistake on image sizes when configuring your Paperclip image sizes.

Simple changes like below would require you to resize all images on your Product Model

class Product < ActiveRecord::Base
has_attached_file :image, :styles => {
    :product_page => "400x400#",
  }
// changed to
class Product < ActiveRecord::Base
has_attached_file :image, :styles => {
    :product_page => "300x400#",
  }

What you can do is use the rails console and run the following:

$ rails c
1.9.3-p448 :001 > Product.all.each{|p| p.image.reprocess!}

Voila! All Product image attributes will be updated to the new size!