Last active
August 29, 2015 14:04
-
-
Save geranyl/f2004a51486411687c25 to your computer and use it in GitHub Desktop.
One line Carrierwave regeneration of images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For an uploader mounted on a model | |
Model eg: | |
class Post < ActiveRecord::Base | |
attr_accessible :title, :body, :published, :image, :tags, :author, :description, :image_cache, :remove_image, :tag_ids, :tags_attributes | |
has_many :post_tags | |
has_many :tags, through: :post_tags | |
mount_uploader :image, AssetUploader | |
end | |
In command line: | |
rails console | |
Post.all.each{|post| post.image.recreate_versions!} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment