This project is archived and is in readonly mode.

#2750 ✓stale
Jacob Kjeldahl

Url parameters and post parameters are only merged on the first level

Reported by Jacob Kjeldahl | June 3rd, 2009 @ 12:42 PM | in 3.x

When posting to a controller it is possible to specify parameters encoded in the url as well as posting them in the body.

When accessing params in the controller they are merged together and everything is fine.

Except when you post the following

http://example.com/action?report[name]=report&report[desc]=blah...

and the body goes like
report[data]=123,23423,324,234,2345,43

Then params just contain {:report => {:name => 'report', :desc => 'blahblah}}

and the data field is discarded.

It seems to be Rack::Request#params or ActionController::Request#parameters responsible for merging the parameters and it is done using Hash#merge which will just overwrite the hashes in the params hash instead of merging them.

There are no comments so I am not sure this is done on purpose.

I would like them hashes to merge so I get

{:report => {:name => 'report', :desc => 'blahblah', :data => '123,23423,324,234,2345,43'}}

I am not sure whether this is a good idea or it will get too complicated, but it will make some things easier.

Any thoughts?

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>

Attachments

Pages