A Rails Question

November 20, 2008 – 11:17 am

One of our project students has a weird problem with Rails — if you have an answer (weird or otherwise), we’d like to hear from you.

  • I want to send an AJAX request to the server using POST.
  • Rails is supposed to handle parameter passing, placing all parameters in the params hash.
  • When I use Ajax.Request using POST, the variables that I’m passing are not reaching the params hash.
  • It works with GET though!

If I do:

render :text => request.inspect

I can see my POST parameters in @parameters in the request object, but somehow these aren’t making it to my params hash.

And here’s the kicker: parameters pass just fine on my partner’s laptop. So I’ve pinned it down to either a problem with my Rails installation, or a problem with my version of OLM. A complete purge and reinstall of Rails hasn’t helped. Neither has a complete reload of the code from the repository.

Later: problem solved — it was Firebug’s fault.

  1. 3 Responses to “A Rails Question”

  2. Any chance you are being redirected from, say, example.com to http://www.example.com by the web server? This strips off any POST parameters invisibly. Or, it could be an issue with Rails’ AJAX security measures.

    By Ana Nelson on Nov 21, 2008

  3. This sounds like a perfect Question to ask on Stackoverflow.com

    where I’m just a user.

    By Jonathan on Nov 22, 2008

  4. Problem solved! I was using an older alpha version of Firebug 1.2.1. It was capturing the AJAX POST request, but wasn’t letting the parameters through. Updated to latest Firebug, and problem is solved.

    Thanks Greg, Ana,

    -Mike

    By Mike on Nov 23, 2008

Post a Comment