This is my source code
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
I get an error on this line
respond_to do |format|
and the error message is "You have a nil object when you didn't expect it. The error occurred while evaluating nil.call".
The five lines from the stack trace are as follows
/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'
I have no idea on how to debug this and I cannot understand how can this error be raised.
Any help is truly appreciated.
Thanks