[Rails] HTTP POST of XML

Alex Young alex at blackkettle.org
Wed Feb 1 13:37:31 GMT 2006


Mark Wales wrote:
> Also, I have tried coding a client to do an HTTP POST of what appeared 
> to be the parameters to some simple RAILS applications (like recipe from 
> InstantRails) and it appears that Rails expects a **nested** name-value 
> pair – something my client software can’t currently do. Can someone 
> explain why Rails does this and if there are any work-arounds?
Rails actually does some magic query-key parsing to make that work.  As 
long as you can submit key-value pairs with arbitrary keys, you should 
be able to get the nested values to work.  Something like:

   http://rails.app/my/query?val[a]=foo&val[b]=bar

should give you a params array like:

   params = {:val =>{:a=>'foo', :b=>'bar'}}

I don't know if that's enough to get your client to work, though...

-- 
Alex


More information about the Rails mailing list