ActiveStorage file upload change doesn't work while updating with other attributes

Viewed 176

I have an Item model and has many titles each with a cover image as attachement. Now while updating an item record, nested fields for titles also gets passed with along with it. While creating new record, cover images is attached properly but when updating an existing record without any attribute change in Item model

This is for update action. I tried other ways like https://blog.capsens.eu/how-to-use-activestorage-in-your-rails-5-2-application-cdf3a3ad8d7

def item_params
    params.fetch(:item, {}).permit(
      :name,
      title_attributes: [
        :cover ]
    )

It doesn't save cover image change if saved without any other attribute change like name in parent or any other attribute in child (other than cover)

0 Answers
Related