Changed Accept header to use "application/json" to signal to the application that it wants a json object. This frees up other response methods, particularly a javascript response.
Changed Accept header to use "application/json" to signal to the application that it wants a json object. This frees up other response methods, particularly a javascript response.

Also, it should be noted that the put method should not redirect, but just end:

if @person.update_attributes(params[:person])
   flash[:notice] = 'Person was successfully updated.'
   format.html {redirect_to( @person )}
   format.json {render :nothing => true}
   format.js  # update.js.erb
else
  format.html {render :action => :edit} # edit.html.erb
  format.json {render  :nothing => true}
  format.js  {render :action => :edit} # edit.js.erb
end

Also of note, the jrails plugin breaks this - the jrails.js file overrides the Accept header. :(

1uptalent/rest_in_place,janv/rest_in_place,janv/rest_in_place,janv/rest_in_place,nberger/rest_in_place,1uptalent/rest_in_place,nberger/rest_in_place