OLM On Rails

Prototype/Ajax.Request -> Rails – The Plot Thickens Part 2

with one comment

Still no solution in sight.  I’ve tried creating a brand new Rails project, and the behaviour persists there as well.  I’m convinced it’s a problem with Rails though, and not a problem in my machine.

Let’s go over the facts again:

  • I have Rails 2.1.0 installed on an Ubuntu 8.04 Hardy Heron Tablet PC
  • I’m using a Postgres database on the OLM project
  • Using Prototype JS library V
  • We’re using Mongrel, not WeBRICK
  • Using Ajax.Request with the ‘POST’ method does not pass any parameters to the params hash in the target controller
  • It works with GET though!
  • When using POST, I can see the parameters if I inspect the request object – they’re in @parameters, which I cannot seem to access
  • POSTing seems to work on other computers, using the same OLM code checked out from the repository
  • I’ve tried a complete reinstall of Rails, with the same result

Maybe my uninstall assumption is wrong:  what’s the best way to completely purge Rails from my machine?  I essentially followed these steps before:

Thoughts from anybody?



Written by Mike Conley

November 21, 2008 at 3:04 am

One Response

Subscribe to comments with RSS.

  1. Are you both using the same browser? What is the CONTENT_TYPE of the POST?

    This seems suspect to me:


    # Modern REST web services often need to submit complex data to the web application.
    # The @@param_parsers hash lets you register handlers which will process the HTTP body and add parameters to the
    # params hash. These handlers are invoked for POST and PUT requests.
    # By default application/xml is enabled. A XmlSimple class with the same param name as the root will be instantiated
    # in the params. This allows XML requests to mask themselves as regular form submissions, so you can have one
    # action serve both regular forms and web service requests.
    # Example of doing your own parser for a custom content type:
    # ActionController::Base.param_parsers[Mime::Type.lookup(‘application/atom+xml’)] = Proc.new do |data|
    # node = REXML::Document.new(post)
    # { node.root.name => node.root }
    # end
    # Note: Up until release 1.1 of Rails, Action Controller would default to using XmlSimple configured to discard the
    # root node for such requests. The new default is to keep the root, such that “David” results
    # in params[:r][:name] for “David” instead of params[:name]. To get the old behavior, you can
    # re-register XmlSimple as application/xml handler ike this:
    # ActionController::Base.param_parsers[Mime::XML] =
    # Proc.new { |data| XmlSimple.xml_in(data, ‘ForceArray’ => false) }
    # A YAML parser is also available and can be turned on with:
    # ActionController::Base.param_parsers[Mime::YAML] = :yaml

    That’s the first thing that looked promising after I acked for “params” in the rails source. Other than that, where’s your debugger?

    Jeff Balogh

    November 21, 2008 at 6:54 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: