This project is archived and is in readonly mode.

#2584 ✓committed
Matthew Moore

2.3.2 ActiveResource JSON doesn't send parameters with root node

Reported by Matthew Moore | April 30th, 2009 @ 06:40 PM | in 2.x

If you create a new 2.3.2 rails project with an ActiveResource model with format set to JSON, e.g.


class MyModel < ActiveResource::Base
  self.site = "http://localhost:3001"
  self.format = :json
  self.timeout = 30
end

When you try to create a my_model, it won't send in the parameters correctly (it will be missing the root node):


> m = MyModel(:foo => 'bar')
> m.save

The parameters sent to the server should be


my_model[foo]=bar

Instead, it's just:


foo=bar

On the other hand, if you set the format to :xml, you will get the correct parameters sent,


my_model[foo]=bar

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages