I upgraded my rails app from rails 2.3.14
to rails 3.2.6
. In my model i have the following method that is being called from my view for image editing purpose.
def logo_geometry(style = :original)
@geometry ||= {}
@geometry[style] ||= Paperclip::Geometry.from_file(logo.to_file(style)) # works with s3
end
when this method is called following error occurs.
undefined method `to_file' for #<Paperclip::Attachment:0xd9d06e0>
Any suggestion to achieve the functionality of to_file
method??
Answer to my own question.
replace logo.to_file(style)
with Paperclip.io_adapters.for(logo.styles[style])
.
so method will be be like this..
def logo_geometry(style = :original)
@geometry ||= {}
@geometry[style] ||= Paperclip::Geometry.from_file(Paperclip.io_adapters.for(logo.styles[style]))
end
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