i have a question/problem - im not sure actually, maybe this is how it should behave(?)
I'm using Rails 4 with carrierwave to upload files, I just added the minimagick gem to create versions of the uploaded images.
when i upload image - it works great and make the version.
but when i load a page with images it seems to call the "version" method for every image that is displayed in the screen.... (and its not the upload process! only showing images!)
So even before i uploaded an image and actually created a version of it -> i've added a 'version' method to my uploader file -> refreshed a page in my site -> 'version' method was called (didnt upload anything yet)
my uploader file:
class PhotoUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :fog
version :nav_thumb, if: :is_avatar? do
process :resize_to_fit => [50, 50]
end
version :box_thumb, if: :is_logo? do
process :resize_to_fit => [40, 40]
end
def is_avatar?(picture)
mounted_as == :avatar
end
def is_logo?(picture)
mounted_as == :logo
end
end
it seems that every image displayed in my page is getting to the is_avatar?
method (i used pry
debugger to see whats going on)
and -> it makes my page load slower, which is the opposite of what i wanted to achieve with smaller image versions.
is this normal behaviour? should it go to the version
methods every time i load an image?
what should i do to fix it?
thanks.