I have a model with paperclip ruby gem. I defined an attached file with 2 processors (thumbnail
and watermark
).
The question is if exist the way to apply the watermark processor if condition is true
. (the idea it's not define new attached_files without watermark processor)
Thanks in advance.
I try using this code, but dosen't works. If the field eid exist process with watermark else if null process only thumbnail
:processors => lambda { |a|
if a.eid.nil?
[:thumbnail,:watermark]
else
[:thumbnail]
end
},
The processors
option could accept proc, so you could make your processors depend on instance:
:processors => lambda{ |attachment|
attachment.instance.some_method_to_get_processors_here
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With