kirtithorat / carrierwave-crop

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

Uploader with random unique filenames #13

Closed bdsword closed 9 years ago

bdsword commented 9 years ago

As mention here,when you are generating random unique filenames, recreate_versions! doesn't save the new filename to the database.

So I have to call save! by myself after update_attributes

def update
   @model.update(model_update_params)
   @model.save!
   respond_with @model
 end

Is there a better solution?

kirtithorat commented 9 years ago

@bdsword Shouldn't this be raised in carrierwave gem as it handles the uploading & saving of files part?

bdsword commented 9 years ago

Thank you for your prompt reply.

After some research, the extra save! seems a restriction, and it's the only solution for this problem.

I guess there is no way to put this extra save! inside crop_image. `cause it's inside after_update callback.

So I'll keep using the extra save!.

kirtithorat commented 9 years ago

Close #13