我有下面的代碼在我的控制器Rails的多張貼問題
<% form_for @picture, :picture, :url=>pictures_url, :html => { :multipart => true } do | form | %>
<%=form.file_field :image%>
<%=submit_tag 'Save'%>
<%end%>
當我打開它提交到以下控制器
class PicturesController < ApplicationController
def create
render :text=>1
end
end
:多=>真的,我得到以下錯誤但是,如果我不使用多部分,那麼它一切正常?
/!\ FAILSAFE /!\ Tue Jun 29 09:59:47 +0100 2010
Status: 500 Internal Server Error
wrong number of arguments (1 for 0)
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:338:in `initi
ze'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:338:in `new'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:338:in `parse
ltipart'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:323:in `loop'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/utils.rb:323:in `parse
ltipart'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb:133:in `POS
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:15:i
call'
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/par
_parser.rb:15:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/ses
n/cookie_store.rb:93:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/fai
fe.rb:26:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchro
e'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dis
cher.rb:114:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/rel
er.rb:34:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dis
cher.rb:108:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in
all'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `each'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb:1
n `call'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb:13:i
call'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/webrick.rb:50:
`service'
C:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
C:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
C:/Ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
C:/Ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
C:/Ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
C:/Ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
C:/Ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
C:/Ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
C:/Ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
C:/Ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/webrick.rb:14:
`run'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_orig
l_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
任何建議,對不起,如果這是一個新手的錯誤,但我剛剛開始學習rails。
感謝
安迪
這似乎是在我的Rails應用程序的奇怪的問題,如果我再創建一個新的這個消失。很奇怪。感謝所有人的幫助。 – 2010-06-30 08:09:26