這是我的源代碼在更新行動NoMethodError被拋出
def update
@recipe = Recipe.find(params[:id])
respond_to do |format|
if @recipe.update_attributes(params[:recipe])
format.html {redirect_to :action => "edit" }
end
end
end
我在這一行
respond_to do |format|
和錯誤消息得到一個錯誤是:「你有一個零對象,當你沒想到它。評估nil.call時發生錯誤「。是
從堆棧跟蹤的五行如下
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/mime_responds.rb:175:in `respond'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/mime_responds.rb:173:in `each'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/mime_responds.rb:173:in `respond'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/mime_responds.rb:107:in `respond_to'
/Path from my machine to the app/app/controllers/recipes_controller.rb:43:in `update'
我對如何調試這個不知道,我不明白怎麼能這個錯誤得到提升。
任何幫助是真正的讚賞。
感謝
感謝託比。它有幫助,現在我必須檢查我的MIME類型配置。 – iJK 2010-01-11 15:32:42