Home Carrierwave limited conditional processing
Reply: 0

Carrierwave limited conditional processing

Jerome
1#
Jerome Published in 2018-01-04 01:50:38Z

The following protected methods have no glaring errors in them

def is_header? image
  !model.image_h? && !model.image_v?
end

def is_v? image
  model.image_v?
end

def is_h? image
  model.image_h?
end

In fact the logic of using the two model attributes works for the first case.

Yet, when running the image upload and resize

version :small_v, if: :is_v? do
  process :resize_to_limit => [180, 300]
end

version :small_h, if: :is_h? do
  process :resize_to_limit => [320, 102]
end

version :medium, if: :is_header? do
  process :resize_to_limit => [640, 120]
end

version :small, if: :is_header? do
  process :resize_to_limit => [416, 78]
end

The former two (having example params image_v: "f", image_h: "t" never process, whereas the latter two do (with params image_v: "f", image_h: "f")

What am I missing here to make the is_h and is_v methods to fire?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.33257 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO