bicunisa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-14 05:29 UTC
Rails complaining about {:method=>:get} on an AJAX call
Hello guys, I hope you can point me in the right direction. I just moved to Rails 2.0 and I''m having some problems. I''m using ExtJS (excellent widget library btw), to make my application. Right now I''m testing a login form that I''m developing for a web application, the login form sends the info throught AJAX. I get a 404 error from the server, it complains that the method used to pass the values was GET, but I''m pretty sure it was a POST, here is the firebug error: -> POST http://localhost:3000/session/404 (313ms) And this is what firebug report in the [Headers | Post | Response]: [Post] =========================================================================module=login&login=Sergio %20Loredo&password=cevival&authenticity_token=7e4f20fa543cae7c01921acf0c772d81fdb81138 As you can see the [Post] tab in firebug is representing the data I sent as a GET string. Why is that? [Response] =========================================================================Routing Error No route matches "/" with {:method=>:get} I''m clueless as to why is this behaving this way, aren''t AJAX calls supposed to be always POST? I''m using restful_authentication, and the URL the form is trying to POST to is /session (I have map.resource :session). If you need more info, just tell me and I will reply with it. Thanks in advance, Adrián. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2007-Dec-14 05:34 UTC
Re: Rails complaining about {:method=>:get} on an AJAX call
What''s the code you''re using to make the ajax call? On Dec 14, 2007 3:59 PM, <bicunisa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello guys, > > > I hope you can point me in the right direction. I just moved to Rails > 2.0 and I''m having some problems. > I''m using ExtJS (excellent widget library btw), to make my > application. > > Right now I''m testing a login form that I''m developing for a web > application, the login form sends the info throught AJAX. > > > I get a 404 error from the server, it complains that the method used > to pass the values was GET, but I''m pretty sure it was a POST, here is > the firebug error: > -> POST http://localhost:3000/session/404 (313ms) > > And this is what firebug report in the [Headers | Post | Response]: > > [Post] > =========================================================================> module=login&login=Sergio > > %20Loredo&password=cevival&authenticity_token=7e4f20fa543cae7c01921acf0c772d81fdb81138 > > As you can see the [Post] tab in firebug is representing the data I > sent as a GET string. Why is that? > > > [Response] > =========================================================================> Routing Error > > No route matches "/" with {:method=>:get} > > > I''m clueless as to why is this behaving this way, aren''t AJAX calls > supposed to be always POST? > > I''m using restful_authentication, and the URL the form is trying to > POST to is /session (I have map.resource :session). > > If you need more info, just tell me and I will reply with it. > > > Thanks in advance, > Adrián. > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
bicunisa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-14 05:42 UTC
Re: Rails complaining about {:method=>:get} on an AJAX call
I''m using ExtJS as I said, and it abstracts the AJAX calling. Here is the code for the form: This is the code of the form: [CODE] var submitUrl = ''/session''; var formPanel = new Ext.form.FormPanel({ baseCls: ''x-plain'', method: ''post'', baseParams: { module: ''login'' }, bodyStyle: ''background:#f9f9f9 none; color:#222; padding:5px 35px;'', defaults: { width: 200 }, defaultType: ''textfield'', frame: false, height: 70, id: ''login-form'', items: [{ fieldLabel: ''Nombre de usuario'', name: ''login'', value: ''usuario'' },{ fieldLabel: ''Contraseña'', inputType: ''password'', name: ''password'', value: ''contraseña'' },{ inputType: ''hidden'', name: Ext.get(''authenticity_token'').dom.getAttribute(''name''), hidden: true, value: Ext.get(''authenticity_token'').dom.getAttribute(''value'') }], labelWidth:120, region: ''south'', url: submitUrl }); [/CODE] Or can I get the info you want from firebug? if so, if you tell me I can get it for you. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2007-Dec-14 05:44 UTC
Re: Rails complaining about {:method=>:get} on an AJAX call
Um. Wow. I have no idea about ExtJS sorry. That seems to be a huge amount of code, I hope it does something useful. On Dec 14, 2007 4:12 PM, <bicunisa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m using ExtJS as I said, and it abstracts the AJAX calling. Here is > the code for the form: > > > This is the code of the form: > [CODE] > var submitUrl = ''/session''; > > var formPanel = new Ext.form.FormPanel({ > baseCls: ''x-plain'', > method: ''post'', > baseParams: { > module: ''login'' > }, > bodyStyle: ''background:#f9f9f9 none; color:#222; > padding:5px > 35px;'', > defaults: { > width: 200 > }, > defaultType: ''textfield'', > frame: false, > height: 70, > id: ''login-form'', > items: [{ > fieldLabel: ''Nombre de usuario'', > name: ''login'', > value: ''usuario'' > },{ > fieldLabel: ''Contraseña'', > inputType: ''password'', > name: ''password'', > value: ''contraseña'' > },{ > inputType: ''hidden'', > name: > Ext.get(''authenticity_token'').dom.getAttribute(''name''), > hidden: true, > value: > Ext.get(''authenticity_token'').dom.getAttribute(''value'') > > }], > labelWidth:120, > region: ''south'', > url: submitUrl > }); > [/CODE] > > Or can I get the info you want from firebug? if so, if you tell me I > can get it for you. > > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
bicunisa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-14 05:50 UTC
Re: Rails complaining about {:method=>:get} on an AJAX call
Yeah, what I''m trying to understand is why would my POST parameters end like a GET string, if Firebug is clearly showing a POST. If I understand why that happens, I might be able to correct the error. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
bicunisa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-14 06:23 UTC
Re: Rails complaining about {:method=>:get} on an AJAX call
Shame on me, it was a problem with the Rails app, it was doing a redirect to another page in the method that was invoked in the AJAX call. I think that explains why I was getting my POST params as a GET string. Well at least I hope this can help someone with my same problem ;) On Dec 13, 11:50 pm, bicun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Yeah, what I''m trying to understand is why would my POST parameters > end like a GET string, if Firebug is clearly showing a POST. > > If I understand why that happens, I might be able to correct the error.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---