On Tue, Mar 17, 2009 at 5:29 PM, Enzo Rivello < [email protected]> wrote:
> > 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}</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 > > -- > Posted via http://www.ruby-forum.com/. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

