0
votes

I have tried many times to save new image after carrierwave keep file after validation fail, but not success.

<%= form_for @user, :html => {:multipart => true} do |f| %>
  <p>
    <label>My Avatar</label>
    <%= f.file_field :avatar %>
    <%= f.hidden_field :avatar_cache %>
  </p>
<% end %>

I had to sanitize parameter for :avatar, :avatar_cache, ...

It has still display new image ,but when i save the form the new image not saved.

1
Can you see which validation failed or what the validation error was? - Tom Kadwill
not a lot to go on here im afraid, more details needed - Richlewis
TomKadwill I'm choose another image , and set user.name = nil and then I saved it , carrierwave still keep new image file , I continue set user.name = 'Peter' and saved it, but new image not saved. - Luan D
avatar_cache = nil , when I update the use form. - Luan D

1 Answers

0
votes

Make sure :avatar_cache is included in your permitted params.