PDA

View Full Version : Posting data from extjs to rails resets session



rhmorgan
12 May 2012, 9:34 AM
I am new to extjs so this may be an easy question. I am trying to post data from the extjs front end to the rails backend using a rest proxy. I am able to GET data using this same proxy without a problem; however, whenever I POST data it does actually do the post but it resets the session. So when i do another request after the post it gives me an error message because it wants me to resign into the application. Below is some testing I was doing in Firebug.

Ext.define('gradesModel', {
extend: 'Ext.data.Model',

fields: [
{
name: 'id'
},
{
name: 'assignment_id'
},
{
name: 'comments'
},
{
name: 'rating_id'
}

],

proxy: {
type: 'rest',
url: '/grades',
// extraParams: { authenticity_token: "<%= form_authenticity_token %>" },
format: 'json',
reader: {
type: 'json'
},
writer: {
type: 'json',
root: 'grade'
}
}
});

var grade = Ext.create('gradesModel', {comments: 'testme', rating_id: '1', assignment_id: '6'});

grade.save();

scottmartin
15 May 2012, 6:17 AM
I would guess this is on the server config, as there is nothing that I can think of that would cause this from the client.

I know when I used CodeIgniter, they had a security feature built int by default to change the session ID on a timed basis. You may want to snoop around your session config.

Regards,
Scott.