You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to generate few versions using my carrierwave uploader (rails 4.0.3, carrierwave 2.2.2) but all i can see is an exception SystemStackError: stack level too deep. My code looks like that:
keyframe_uploader.rb
class KeyframeUploader < CarrierWave::Uploader::Base
# ...
# Keyframe thumbnail sizes
version :small do
process resize_to_fill: [180, 180], if: :square?
process resize_to_fill: [320, 180], if: :not_square?
end
version :medium do
process resize_to_fill: [460, 460], if: :square?
process resize_to_fill: [640, 460], if: :not_square?
end
version :large do
process resize_to_fill: [720, 720], if: :square?
process resize_to_fill: [1280, 720], if: :not_square?
end
private
# Checks if image is a square
def square? file
img = Magick::Image.read(file.path)
img[0].columns == img[0].rows
end
# Oposite to #square?
def not_square? file
!square? file
end
end
keyframe.rb
class Keyframe < ActiveRecord::Base
belongs_to :video
mount_uploader :file, KeyframeUploader
end
Stack trace
SystemStackError: stack level too deep
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/workspace.rb:86
I'm trying to generate few versions using my carrierwave uploader (rails 4.0.3, carrierwave 2.2.2) but all i can see is an exception
SystemStackError: stack level too deep
. My code looks like that:keyframe_uploader.rb
keyframe.rb
Stack trace
Have you any idea what can be wrong i here? Original question: http://stackoverflow.com/questions/22206350/stack-level-too-deep-when-using-carrierwave-versions-with-sidekiq
Thanks in advance!
The text was updated successfully, but these errors were encountered: