Ruby on Rails:Attachment_FUを使用してファイルをアップロードしようとするときのサーバーエラー:( nilを整数に変換できません)
-
26-10-2019 - |
質問
簡単な例に従ってファイルをアップロードしました(以下のコードへのリンクを参照)。 formをアップロードするとフィールド<%= f.file_field:uploaded_data%>、および[AAファイル添付ファイルの有無にかかわらず]フォームの[送信]ボタンをクリックすると、Webページでエラーメッセージが表示されます:500内部サーバーエラー
サーバーログでエラーメッセージが表示されます:typeRerr(nilを整数に変換することはできません):
私はRails 3.0.5、Ruby 1.9.2、Windows7です
サンプルコードをhttp://clarkware.com/blog/2007/02/24/file-upload-fuで使用しました
以下に、サーバーログの印刷が表示されます。
Rendered mugshot/new.html.erb within layouts/application (10.0ms)
Completed 200 OK in 289ms (Views: 49.0ms | ActiveRecord: 0.0ms)
Error during failsafe response: ActionView::Template::Error
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/whiny_nil.rb:48:in `method_missing'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_dispatch/http/parameters.rb:10:in `parameters'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb:3:in `_c___uby____
lib_ruby_gems_______gems_actionpack_______lib_action_dispatch_middleware_templates_rescues_diagnostics_erb___637362275_26463528_704965928'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_view/template.rb:135:in `block in render'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/notifications.rb:54:in `instrument'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_view/template.rb:127:in `render'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_view/render/rendering.rb:59:in `block in _render_template'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/notifications.rb:52:in `block in instrument'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/notifications.rb:52:in `instrument'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_view/render/rendering.rb:56:in `_render_template'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_view/render/rendering.rb:26:in `render'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_dispatch/middleware/show_exceptions.rb:88:in `rescue_action_locally'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_dispatch/middleware/show_exceptions.rb:68:in `render_exception'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_dispatch/middleware/show_exceptions.rb:59:in `call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/rack/logger.rb:13:in `call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/runtime.rb:17:in `call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/lock.rb:11:in `call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_dispatch/middleware/static.rb:30:in `call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:168:in `call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/rack/log_tailer.rb:14:in `call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/content_length.rb:13:in `call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/handler/webrick.rb:52:in `service'
c:/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
c:/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
c:/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
2011-03-16 23:12:29 -0700で127.0.0.1の投稿「/マグショット」を開始
typeReror(nilを整数に変換できません):
他のヒント
Attachment_Fuにはいくつかの変更がありますが、Rails3.Stillで利用可能です。attachment_fu
私もそのような問題に直面しています。問題は、Attachment_FU GEMまたはプラグインが原因です。アンインストールして、他のプラグインまたはGEMを使用するだけで問題が解決します。
所属していません StackOverflow