Hi all!!
Recently , i tryed to integrate flex and rail, and it was a nice work,
really fast and flexible, until a curious bug
On my local development machine, i try to destroy an item trough an id,
and all goes well.
i set up on the production machine and pop-up this error:
NoMethodError (undefined method `’ for nil:NilClass)
here’s the code of the mxml in question:
<mx:HTTPService contentType=“application/xml” id=“destroy_question”
url=“http://localhost:3000/admin/questions/destroy_question_xml”
useProxy=“false” method=“POST” result=“object_destroyed()”
fault=“object_not_destroyed()” >
<mx:request xmlns=""> <question> <id>{[qdg.selectedItem.id](http://qdg.selectedItem.id)}</id> </question> </mx:request> </mx:HTTPService>
and here’s the controller:
def destroy_question_xml
if params[:question][:id][:value] @question = Question.find(params[:question][:id][:value]) @question.destroy @question.save end
end
The curious thing is that actually, on production machine, it send
correctly the values(“question”=>{“id”=>{“type”=>“integer”,
“value”=>“96”}}) , but still pop up the error NoMethodError (undefined
method `’ for nil:NilClass).
Someone has some thougt on this?
thanks a lot for reading
Hi, the last two lines seem suspect because you’re trying to delete and save something. For example,
def destroy_question_xml
if params[:question][:id][:value] @question = Question.find(params[:question][:id][:value]) @question.destroy @question.save end end
Thus, I would recommend checking your logic.
Good luck,
-Conrad