unknown
December 14, 2007, 6:29am
1
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.
unknown
December 14, 2007, 6:35am
2
What’s the code you’re using to make the ajax call?
On Dec 14, 2007 3:59 PM, [email protected] wrote:
application, the login form sends the info throught AJAX.
Routing Error
If you need more info, just tell me and I will reply with it.
Thanks in advance,
Adrián.
–
Ryan B.
unknown
December 14, 2007, 6:42am
3
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:
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
});
Or can I get the info you want from firebug? if so, if you tell me I
can get it for you.
unknown
December 14, 2007, 6:51am
4
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.
unknown
December 14, 2007, 6:45am
5
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, [email protected] wrote:
baseCls: 'x-plain',
defaultType: 'textfield',
name: 'password',
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 B.
unknown
December 14, 2007, 7:23am
6
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