From b93199b547303a1656282a2591db84de0b6d2a9f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 11 Apr 2011 15:50:05 +0200 Subject: Keep the same API semantics for update/delete as we had for XML (just return 200 OK, no body) --- .../generators/rails/scaffold_controller/templates/controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb index a8a1c07d1f..32b961d9fc 100644 --- a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb @@ -62,7 +62,7 @@ class <%= controller_class_name %>Controller < ApplicationController respond_to do |format| if @<%= orm_instance.update_attributes("params[:#{singular_table_name}]") %> format.html { redirect_to @<%= singular_table_name %>, <%= key_value :notice, "'#{human_name} was successfully updated.'" %> } - format.json { render <%= key_value :json, '{}' %>, <%= key_value :status, ':ok' %> } + format.json { head :ok } else format.html { render <%= key_value :action, '"edit"' %> } format.json { render <%= key_value :json, "@#{orm_instance.errors}" %>, <%= key_value :status, ':unprocessable_entity' %> } @@ -78,7 +78,7 @@ class <%= controller_class_name %>Controller < ApplicationController respond_to do |format| format.html { redirect_to <%= index_helper %>_url } - format.json { render <%= key_value :json, '{}' %>, <%= key_value :status, ':ok' %> } + format.json { head :ok } end end end -- cgit v1.2.3