{
...
"audit_state_enum": 0 // { 0: not_reviewed, 1: no_changes, 2: changes, 3: full_auto, 4: full_not_reviewed }
...
}
This file contains hidden or 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
| ## Update icon_urls hash | |
| def migrate_category_icons(dry_run = true) | |
| Category.all.no_timeout.batch_size(200).each do |cat| | |
| #V4 icons | |
| cat.icon_urls = {} if cat.icon_urls == nil | |
| if cat.active_icon_url.present? && cat.icon_urls['default'] == nil | |
| cat.icon_urls['default'] = cat.active_icon_url | |
| cat.save unless dry_run | |
| puts "Updating #{cat.id} from active_icon_url: icon_urls['default'] = #{cat.icon_urls['default']}" |
This file contains hidden or 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
| ``` | |
| image = Magick::Image.read(icon_url) | |
| image = image.quantize(256, Magick::GRAYColorspace) | |
| colored = Magick::Image.new(60, 60) { self.background_color = "red" } | |
| colored.composite!(image.negate, 0, 0, Magick::CopyOpacityCompositeOp) | |
| colored.write(output_filename) | |
| ``` |