Paperclip en Windows - método indefinido `split' para nil:NilClass

I am getting undefined method `split' for nil:NilClass when I am trying to save uploaded file

@user.avatar=params[:user][:avatar]

Here is the error from 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 guess the problem in that the filename is too long (C:/progs/web/ror_site_1/tmp/Rus220120701-4976-1sky1nn20120701-4976-a9j1sh20120701-4976-tm6qoj) and cannot be read in Windows. If that is true, how to change filename generation rules?

If not, that is the reason for the issue?

preguntado el 01 de julio de 12 a las 01:07

1 Respuestas

This is a problem with the few latest releases of paperclip (se explica aquí).I also had this problem, and it wasn't until I set paperclip back to version 3.0.4 that it worked again.

So just put this in your Gemfile until the fix is released:

gem 'paperclip', '3.0.4'

Respondido 02 Jul 12, 15:07

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.