I’m getting this error with the Paperclip gem.
NoMethodError (You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.size):
paperclip (2.3.8) lib/paperclip/attachment.rb:104:in `assign'
How can I debug this, seeing as though it’s in a gem? If this was my code I would place a few puts to see what’s going on, but I can’t do that here. I’m using Rails 3.0.1
here’s my best shot.
debuggerline to it. We need the debugger to kick in to set the breakpointrun rails --debugGem.find_files("attachment.rb")<- I’ll call $GEM_ROOT to the path that this returnslist $GEM_ROOT/lib/paperclip/attachment.rb:104– this will show the code around the area where the error occurred.b $GEM_ROOT/lib/paperclip/attachment.rb:$LINE– replace $LINE for a good candidate for the breakpoint.contI think there must be a way to get the path to the gem file programmatically, but I have no idea how to do it 🙁