mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-05 04:34:37 +08:00
Update reprocess Paperclip rake task
This commit is contained in:
parent
6f3378e554
commit
94809013ab
1 changed files with 6 additions and 2 deletions
|
@ -29,9 +29,13 @@ namespace :paperclip do
|
|||
end
|
||||
|
||||
desc 'Reprocess the Assets attachents styles'
|
||||
task reprocess: :environment do
|
||||
task :reprocess, [:before] => :environment do |_, args|
|
||||
error = false
|
||||
Asset.find_each(batch_size: 100) do |asset|
|
||||
assets = Asset
|
||||
if args.present? && args[:before].present?
|
||||
assets = assets.where('updated_at < ?', eval(args[:before]))
|
||||
end
|
||||
assets.find_each(batch_size: 100) do |asset|
|
||||
next unless asset.is_image?
|
||||
begin
|
||||
asset.file.reprocess! :medium, :large
|
||||
|
|
Loading…
Add table
Reference in a new issue