diff options
author | José Valim <jose.valim@gmail.com> | 2011-10-26 09:29:38 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-10-26 09:29:38 +0200 |
commit | aef62c4b4e89e7fa91973c188c9e7f281a44ecd0 (patch) | |
tree | a95ad005538d00d71ee0df0de9977d2fac7aeda6 /railties/lib | |
parent | 20c59dd214b771efd978c7b35b314a785ffc176a (diff) | |
download | rails-aef62c4b4e89e7fa91973c188c9e7f281a44ecd0.tar.gz rails-aef62c4b4e89e7fa91973c188c9e7f281a44ecd0.tar.bz2 rails-aef62c4b4e89e7fa91973c188c9e7f281a44ecd0.zip |
Scaffold returns 204 No Content for API requests without content. This makes scaffold work with jQuery out of the box.
Diffstat (limited to 'railties/lib')
-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 32b961d9fc..4ff15fd288 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 { head :ok } + format.json { head :no_content } 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 { head :ok } + format.json { head :no_content } end end end |