Check why this doesn't work
def should_update_dominant_color?
image.attached? &&
(saved_change_to_attribute?('image_attachment_id') || image.attachment&.saved_change_to_blob_id?)
end
maybe there is some other way to check if the image was changed.
You can try to use some other callback like "before_save" and check if an image was changed and set some flag. And later use "after_commit" and that flag to run your logic.
In general I think your code should be working but difficult to say why not. What gem are you using for attachments?