I have wrap_parameters format: [:json] in wrap_parameters.rb. I post to the server with jQuery.post('photos', {name: 'flower'});. In photos#create, params is
{"name"=>"flower", "controller"=>"photos", "action"=>"create"}
But I am expecting
{"name"=>"flower", "controller"=>"photos", "action"=>"create", "photos"=>{"name"=>"flower"}}
What am I missing?
The
jQuery.post('photos', {name: 'flower'});call posts params as ‘standard’ form (application/x-www-form-urlencoded or multipart/form-data), not json. Sowrap_parameters format: [:json]does not work.Try to remove
format: [:json]or post json data, something like