Search code examples
ruby-on-railspaperclipspree

How do I refresh paperclip thumbnails with an offset?


I want to refresh/recreate thumbnails with 'paperclip' that have ids above 1000, is there a way to do this?

I've tried everything but forking the gem and adding an offset to the finder.


Solution

  • You can use reprocess! to regenerate a specific set of Paperclip images. Something like:

    Model.where('parent_id > 1000').each do |model|
      model.paperclip_attachment.reprocess!
    end
    

    There's more information available in the paperclip documentation:

    https://github.com/thoughtbot/paperclip/wiki/Thumbnail-Generation