ruby on rails - CarrierWaveDirect passthrough uploading doesn't seem to be creating alternate :thumb version in s3 -
i'm trying thumbnail image saved s3 once original saved, doesn't seem work. original file there, however.
my guess since s3 being submitted image directly, thumbnail creation callback doesn't happen or something.
i've tried doing .recreate_versions!
, , saw s3 doing stuff see on invocation, image.url(:thumb)
still gives link 404 result.
here's uploader's code:
include carrierwave::minimagick include carrierwavedirect::uploader version :thumb process :resize_to_fill => [100, 100] end storage :fog def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end
here's template code generates direct submission form s3:
<% badge.image_uid.success_action_redirect = "http://" + request.host_with_port + "/badge_builders/" + badge.badge_builder.id.to_s + "/edit" %> <%= direct_upload_form_for badge.image_uid |f| %> <div class="form-group"> <%= f.file_field :image_uid, required: true %> <%= f.submit 'submit', class: 'btn btn-primary btn-lg' %> </div> <% end %>
am doing wrong? or there no elegant non-patchy solution? help!
i think instinct on callbacks seems correct. here's fixed (in success_action_redirect logic):
if params[:key] #and @builder.badge.key.include? "${filename}" @builder.badge.key = params[:key] @builder.badge.save @builder.badge.image_uid.recreate_versions! @builder.badge.image_uid = @builder.badge.key @builder.badge.save end