kirtithorat / carrierwave-crop

Carrierwave extension to crop uploaded images using Jcrop plugin with preview.
MIT License
94 stars 58 forks source link

Error when submitting nested form images with a model #18

Open wraithseeker opened 8 years ago

wraithseeker commented 8 years ago

I have a model A that uses Carrierwave Crop and when I submit a nested form that includes multiple model Bs that has an image, I get the following error. Character is Model B.

Model A has many Model B and Model B belongs to Model A

undefined method `image_coverpage_crop_x' for #<Character:0x007fcfdd064528>
if @vn.update(vn_params) // This is the line that raises the error

I have ensured that the strong params in Model A includes the cropping fields and that it allows nested attributes. Everything works fine if I update Model A by itself or Model B by itself. Updating all of them at the same time causes the error.

wraithseeker commented 8 years ago

My quick and dirty fix was to include this field in Model B which does not actually exist and only exists in Model A. Is there a better workaround other than this to solve the issue?

crop_uploaded :image_coverpage