diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2011-04-11 15:50:05 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-04-11 15:50:05 +0200 |
commit | b93199b547303a1656282a2591db84de0b6d2a9f (patch) | |
tree | 00efa63277206003c6f6ec9b2a5f091cacb3f82e | |
parent | 1d8bf4f4f900a905e6350e246a683659b5480ec9 (diff) | |
download | rails-b93199b547303a1656282a2591db84de0b6d2a9f.tar.gz rails-b93199b547303a1656282a2591db84de0b6d2a9f.tar.bz2 rails-b93199b547303a1656282a2591db84de0b6d2a9f.zip |
Keep the same API semantics for update/delete as we had for XML (just return 200 OK, no body)
-rw-r--r-- | railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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 |