Answer the question
In order to leave comments, you need to log in
Why doesn't CarrierWave 1.1.0 load images (works on 0.11.2)?
Hello!
Updated CarrierWave to version 1.1.0 and it stopped downloading files.
Example uploader:
class SmallImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
def store_dir
"uploads/#{model.class.to_s.underscore}/#{model.id}/#{mounted_as}"
end
version :thumb do
process :resize_to_fill => [30, 30]
end
def filename
if original_filename
@name ||= Digest::MD5.hexdigest(File.dirname(current_path))
"#{@name}.#{file.extension}"
end
end
end
class Page < ApplicationRecord
mount_uploader :small_image, SmallImageUploader
end
Started PATCH "/admin/pages/3" for 127.0.0.1 at 2017-07-01 20:33:58 +0300
Processing by Admin::PagesController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"pX1q4bYOc53S3wB1DHIMOQ2cakqNs9yZOlVeoMnfXjY/HdeTw2gm6TxdF5VYduDOwG6ZRHTdo9xhWk8Jd8zVbw==", "page"=>{"parent_id"=>"1", "template_id"=>"3", "is_published"=>"1", "sitemap_included"=>"1", "current_page_id"=>"3", "current_page_parent_id"=>"1", "short_slug"=>"test", "title"=>"тест", "meta_title"=>"тайтл", "meta_description"=>"", "h1"=>"h1 заголовок", "description"=>"", "content"=>"", "small_image"=>#<ActionDispatch::Http::UploadedFile:0x007fd922fe3578 @tempfile=#<Tempfile:/var/folders/fc/brjvffk935ldlwt9k6h7r9y80000gn/T/RackMultipart20170701-3007-irj5st.png>, @original_filename="artSoft.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"page[small_image]\"; filename=\"artSoft.png\"\r\nContent-Type: image/png\r\n">}, "id"=>"3"}
SQL (0.6ms) UPDATE "pages" SET "small_image" = $1, "updated_at" = $2 WHERE "pages"."id" = $3
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question