I have an html form generated by rails, so that when it's submitted, the rails controller can gather all the params for the rails object in one swoop with:
@car_object = Car.new(params[:car])
which results in something like:
@car_object.color = "red";
@car_object.make = "Honda"
etc...
But I also need to have the controller be able to extract the same params when submitted via prototype. I'm currently doing it like:
req = new Ajax.Request('/car', {
method: 'post',
parameters: { authenticity_token: getAuthKey(),
color: color,
make: make
},
In which case the controller has to manually create the car object by getting the individual parameters and assigning them to the new Car object.
How would I create this Ajax request so that when the Rails controller gets it, params[:car] can extract the parameters and assign them to the new Car object on it's pwn?