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 -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Mar 17, 2009 at 5:29 PM, Enzo Rivello < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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 readingHi, 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Conrad Taylor wrote:> On Tue, Mar 17, 2009 at 5:29 PM, Enzo Rivello < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> >> <id>{qdg.selectedItem.id}</id> >> @question.save >> >> 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, > > -Conradyeah, that was a problem, but not the resolution. i got many classes with this kind of class(of course, without the logic error) , and all of them works in local, don''t works on the production server. anyway, thanks a lot for the reply! -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
where exactly is the error? which expression is nil? - params[:question] - params[:question][:id] - params[:question][:id][:value] did you debug it? --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
MaD wrote:> where exactly is the error? > which expression is nil? > - params[:question] > - params[:question][:id] > - params[:question][:id][:value] > > did you debug it?theorically none of them , because the system passes correctly the values ( ("question"=>{"id"=>{"type"=>"integer","value"=>"96"}}) . anyway i''m gonna debug and i''ll say more after -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Little update: in local i use mongrel, in production phusion passenger. can it be a problem? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Enzo Rivello wrote:> Little update: > > in local i use mongrel, in production phusion passenger. > > can it be a problem?problem understood!! the server calls two times the method, because the first is halted by ssl_required Filter chain halted as [:ssl_required] rendered_or_redirected. someone know what this means? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
i don''t know about your system, but maybe you try to do something over ssl and you don''t have it configured for your webserver? --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It means you have a filter called require_ssl in your application. This kind of filter will usuallly either redirect or stop the current request if it is not made over ssl (e.g https://example.com) find the one in your app to see more. Either make the web request over ssl, or skip the filter if you don''t need to use ssl. I''d recommend to use ssl if this is a request that is being authenticated in some way. Cheers, Jeremy On Mar 19, 2:36 am, Enzo Rivello <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Enzo Rivello wrote: > > Little update: > > > in local i use mongrel, in production phusion passenger. > > > can it be a problem? > > problem understood!! > > the server calls two times the method, because the first is halted by > ssl_required > > Filter chain halted as [:ssl_required] rendered_or_redirected. > > someone know what this means? > -- > Posted viahttp://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---