/ / Erro de caminho com Paperclip e JRuby no Windows - ruby-on-rails, clipe de papel, jruby

Erro de caminho com o Paperclip e o JRuby no Windows - ruby-on-rails, clipe de papel, jruby

Estou aprendendo sobre Clipe de papel: anexando arquivos em trilhos

Eu coloco esses códigos para exibir a imagem no show.html.erb

<%= image_tag @user.photo.url %>
<%= image_tag @user.photo.url(:thumb) %>

Na nova página, eu navego em um arquivo (.png) do meu computador e clico em criar. Então eu peguei o erro

Lamentamos, mas algo deu errado.

Como resolver este problema? Por favor ajude!

Quando eu verificar em development.log. Eu encontrei esses erros:

>Status: 500 Internal Server Error
The system cannot find the path specified
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:486:in
initialize"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:486:in
new"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:486:in
parse_multipart"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:471:in
loop"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:471:in
parse_multipart"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/request.rb:268:in
parse_multipart"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/request.rb:146:in
POST"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:15:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/params_parser.rb:15:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/session/cookie_store.rb:99:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/failsafe.rb:26:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:114:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/reloader.rb:34:in
run"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:108:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/rack/static.rb:31:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:49:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in
each"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/rack/log_tailer.rb:17:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/chunked.rb:15:in
call"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:67:in
process"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:159:in
process_client"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:158:in
each"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:158:in
process_client"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
run"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
initialize"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
new"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
run"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in
initialize"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in
new"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in
run"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:38:in
run"
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:111
C:/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:31:in
require"
C:/jruby/jruby-1.5.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require"
./script/server:3
./script/server:2:in `load"
-e:2

Respostas:

0 para resposta № 1

Eu tenho usado a jóia de clipe de papel por um bom tempo, e eu acho que é incrível - Então, não desanime!

Aqui está algumas coisas que eu posso pensar:

(1) Você poderia nos mostrar o seu código de modelo de usuário?

(2) Você aceitou arquivos PNG como um arquivo de imagem válido? Algo assim:

validates_attachment_content_type :avatar, :content_type => ["image/jpeg", "image/png", "image/gif"]

Boa sorte!


0 para resposta № 2

Parece que o seu diretório de upload não é válido. A mensagem que você recebe é uma mensagem de erro do Windows. Você precisa especificar um caminho de upload correto para suas fotos em seu modelo. Por exemplo:

has_attached_file :photo,
:url  => ":style/:basename.:extension",
:path  => ":style/:basename.:extension",
:storage => :filesystem

Espero que ajude.