# Rebake with rails command or rake task doesn't work, but rebuilding HTML does. Why?

**URL:** <https://meta.discourse.org/t/rebake-with-rails-command-or-rake-task-doesnt-work-but-rebuilding-html-does-why/220841>\
**Category:** Self-hosting\
**Created:** [March 13, 2022, 2:02pm UTC](https://meta.discourse.org/t/rebake-with-rails-command-or-rake-task-doesnt-work-but-rebuilding-html-does-why/220841 "2022-03-13T14:02:44Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [March 13, 2022, 2:02pm UTC](https://meta.discourse.org/t/rebake-with-rails-command-or-rake-task-doesnt-work-but-rebuilding-html-does-why/220841/1 "2022-03-13T14:02:44Z")

</div>

Hi!

I’m trying to repair posts with broken images, imported and containing BBcode.

The images show up in the composer previews, but the final post content contains broken images:

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/5/c55cd3da11ccd4e59bbb78b5b6b96426e8a7ca49.jpeg)

after using the “rebuild HTML” feature on some posts and seeing that it repaired the post on my production forum, I rebaked all my posts using the rake task.

I was surprised to see that the posts with the broken image were NOT repaired.

So I experimented a rebake on a specific post on my test forum (same backup ; same data) with both rails command and rake task, and here is the behavior:

- The images show up for a second, but the post quickly comes back to its initial state with broken images.

However, if I use the “rebuild HTML” feature, it works perfectly, and the pictures don’t come back to broken images. They are even correctly uploaded to the server after a few minutes.

So, can someone explain this phenomenon? Why rebake from rails or a rake task has this behavior, and what are the difference between **rebuilding HTML** and a command line **rebake**?

Video captures:

1. from the rails console:  

2. from the rake task:  

I’m very intrigued (and still trying to repair my images in all my posts in batch).

* * *

An example where I used **Rebuild HTML** that shows that this post’s embedded images were properly displayed and automatically uploaded to the server (obviously, their original link, leading to casimages, is still here, but it’s the expected behavior), days ago: [Frensh Vw Bus CHERIZET 2019 SK - #13 par buggyderby - Vos sorties - VW Camper](https://vw-camper.fr/t/frensh-vw-bus-cherizet-2019-sk/12719/13?u=canapin)

---

_[View the full topic](https://meta.discourse.org/t/rebake-with-rails-command-or-rake-task-doesnt-work-but-rebuilding-html-does-why/220841)._
