Closed crystalneth closed 9 years ago
I believe this is an NPE bug. To workaround, check that your attachment is not null.
This isn't an NPE. The attachment exists.
It appears that your interpolations Paperclip::Imgix::Interpolations is extending the Paperclip::Interpolations module. However I don't think extending ruby modules pulls in class methods, only instance methods, and plural_cache is a class method. They should really be calling it by using the fully qualified name, or not use module class methods. The class method lives on the module itself.
This is the reason you've had to copy/paste the #interpolate and #all into your module extension.
My guess is these class methods were recently added.
There is probably a more paperclippy way of doing this, but I don't know it. I've found Paperclip a nightmare to extend in my experience, so not surprised you've had issues like this.
I was able to fix this exception by adding this to your module:
def self.plural_cache
@plural_cache ||= Paperclip::Interpolations::PluralCache.new
end
There are other class methods there, though they don't yet seem to be causing issue.
On Mon, Jul 14, 2014 at 12:24 PM, pihman notifications@github.com wrote:
I believe this is an NPE bug. To workaround, check that your attachment is not null.
— Reply to this email directly or view it on GitHub https://github.com/zebrafishlabs/paperclip-imgix/issues/4#issuecomment-48947379 .
Sent from a device that makes me spell badly and write short emails Alex Neth @crystalneth +1 206 499 4995
Unfortunately, this library is no longer maintained. We're looking for better ways of hooking into Paperclip that is more future-proof than this gem. As a result, we're cleaning up this repo and closing all old tickets.
We do have a lighter-weight gem for building and signing imgix URLs, which works well in tandem with normal paperclip. Please check that out here: https://github.com/imgix/imgix-rb
After installing the gem from github directly, I get this error upon calling the attachment url method.
I'm on Rails 3.2.12 and Paperclip 3.5.4
Trace: