Rails XMLHttpRequest using GET instead of POST

software development


I have a RoR app which works fine on my development computer but after I upload to dreamhost I notice that the XMLHttpRequests are being sent as a GET instead of as a POST, which screws up my return unless request.post? logic.

Is this smething I’ve done somehow? How can I force the XMLHttpRequest to be a POST?


It turns out that the real issue is that after I deploy my rails app the session[:user] variable is not getting set. Why would this work on my machine but not on dreamhost. Can I even do something that would disable this?


I’m even more confused.

When I try and use a form which works on dreamhost I get this…

Processing StatsController#new (for xx.xx.xx.xx at 2006-08-11 22:24:08) [GET]
Session ID: 5bb650876cc6ebfd8fbe1605f8fee520
Parameters: {“action”=>“new”, “controller”=>“stats”}
Completed in 0.07778 (12 reqs/sec) | DB: 0.01224 (15%) | 200 OK

which doesn’t work.

but on my home machine…

Processing StatsController#new (for at 2006-08-11 22:25:25) [POST]
Session ID: e5a8904dd66379df002779de8a2afcd8
Parameters: {“commit”=>“Save”, “date”=>{“month”=>“8”, “day”=>“11”, “year”=>“2006”}, “action”=>“new”, “controller”=>“stats”, “stat”=>{“height_in”=>"", “weight_lbs”=>"", “weight_oz”=>"", “height_ft”=>""}}
User Load (0.022084) SELECT * FROM users WHERE (users.id = 1) LIMIT 1
Biostat Load (0.000808) SELECT * FROM biostats WHERE (date = ‘2006-8-11’) LIMIT 1
Biostat Load (0.000980) SELECT * FROM biostats WHERE (date = ‘2006-8-11’) LIMIT 1
Biostat Columns (0.000503) SHOW FIELDS FROM biostats
SQL (0.002079) BEGIN
Biostat Update (0.024918) UPDATE biostats SET date = ‘2006-08-11’, height = 0.0, weight = 0.0 WHERE id = 8
SQL (0.049138) COMMIT
Biostat Load (0.001343) SELECT * FROM biostats ORDER BY date
SQL (0.000597) SELECT count() AS count_all FROM biostats
Biostat Load (0.000851) SELECT * FROM biostats ORDER BY date LIMIT 1
Photo Columns (0.024376) SHOW FIELDS FROM photos
SQL (0.000631) SELECT count(
) AS count_all FROM photos
Photo Load (0.001020) SELECT * FROM photos ORDER BY RAND() LIMIT 1
Rendered stats/_statRow (0.00547)

which does work. What can I do?


I’m pretty excited that DreamHost offers Rails and I was just about to start trying out some stuff, if I encounter any similar problems I’ll let you know what I figure out.


I’ve never used RoR, so I’m not much help. I just wanted to let you know you aren’t being ignored :wink:

How are the parameters being set? Is this through the xmlhttprequest or through a form or? You can try the generic echo (or whatever the print command is in RoR) the variables while you are testing to see what is different. Maybe there is a session time limit difference between your machine and DH’s?

Check out Gordaen’s Knowledge, the blog, and the MR2 page.