ruby on rails - Remove CarrierWave file from associated model -


what proper way remove attachment through associated model?

i have profile.rb model has_one will.rb model. edited through same form profile. i'm able attach file using :will_attachment field trying use :remove_will_attachment checkbox doesn't work.

the params structure follows:

"portfolio" =>  {"will_attributes" =>     {"remove_will_attachment"     }   } 

i have :will_attachment , :remove_will_attachment in permitted params method.

i'm having remove attachment checking remove_will_attachment == "1" in params , manually calling @portfolio.will.remove_will_attachment! seems there should smoother way this.

am missing something? thanks!

it bug in carrierwave solved on master branch. reason not remove uploaded file if remove_#{column} attribute accessor set.

in carrierwave 0.10, not work

"portfolio" =>  {"will_attributes" =>     {"remove_will_attachment" => true     }  } 

this will

"portfolio" =>  {"will_attributes" =>     {"remove_will_attachment" => true,      "another_attribute" => "changed value"     }  } 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -