-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi there,
I've followed the instructions, and boiled down, the code in use is:
class Bob < ActiveRecord::Base
translates :message, :button_text, :message_footer, :image_landing_url, :square_image
extend CarrierwaveGlobalize
mount_translated_uploader :square_image, SquareImageUploader
endUploader:
class SquareImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
process resize_and_crop: 800
private
def resize_and_crop(size)
manipulate! do |image|
if image[:width] < image[:height]
remove = ((image[:height] - image[:width])/2).round
image.shave("0x#{remove}")
elsif image[:width] > image[:height]
remove = ((image[:width] - image[:height])/2).round
image.shave("#{remove}x0")
end
image.resize("#{size}x#{size}")
image
end
end
endThe problem happens when the resulting form (relevant snippet):
= f.fields_for :translations, bob_translations do |ft|
.col-md-4
.panel.panel-default
.panel-heading
= translation_locale_name(ft.object.locale)
.panel-body
= ft.hidden_field :locale
= ft.file_field :square_image
The form has multipart also set.
But all of the values posted to the fields being saved as string representations of the upload file object, like "#ActionDispatch::Http::UploadedFile:0x00007fd5d44c99e0" - which is not useful.
Any hits for where this might not be working?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels