Windows paperclip - undefined split method for nil: NilClass
I am getting undefined `split 'method for nil: NilClass when I try to save uploaded file
@user.avatar=params[:user][:avatar]
Here is the error from the server log:
[32mCommand[0m :: identify -format %wx%h "C:/progs/web/ror_site_1/tmp/Rus220120701-4976-1sky1nn.jpg[0]"
[32mCommand[0m :: identify -format %m "C:/progs/web/ror_site_1/tmp/Rus220120701-4976-1sky1nn.jpg[0]"
[32mCommand[0m :: identify -format %m "C:/progs/web/ror_site_1/tmp/Rus220120701-4976-1sky1nn.jpg[0]"
[32mCommand[0m :: convert "C:/progs/web/ror_site_1/tmp/Rus220120701-4976-1sky1nn.jpg[0]" -resize "300x300>" "C:/progs/web/ror_site_1/tmp/Rus220120701-4976-1sky1nn20120701-4976-a9j1sh"
[32mCommand[0m :: file -b --mime "C:/progs/web/ror_site_1/tmp/Rus220120701-4976-1sky1nn20120701-4976-a9j1sh20120701-4976-tm6qoj"
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
Completed 500 Internal Server Error in 406ms
NoMethodError (undefined method `split' for nil:NilClass):
app/controllers/users_controller.rb:94:in `block in update'
app/controllers/users_controller.rb:93:in `update'
I think the problem is that the file name is too long (C: / progs / web / ror_site_1 / tmp / Rus220120701-4976-1sky1nn20120701-4976-a9j1sh20120701-4976-tm6qoj) and cannot be read on Windows. If so, how can I change the rules for generating filenames?
If not, is this the cause of the problem?
0
source to share
1 answer
This is a problem with several recent versions of paperclip ( described here ). I also had this problem and it didn't. I installed paperclip back to version 3.0.4 so that it works again.
So, just put this in your Gemfile until a fix is ββreleased:
gem 'paperclip', '3.0.4'
+3
source to share