1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Scaffold returns 204 No Content for API requests without content. This makes scaffold work with jQuery out of the box.

This commit is contained in:
José Valim 2011-10-26 09:29:38 +02:00
parent 20c59dd214
commit aef62c4b4e
2 changed files with 4 additions and 2 deletions

View file

@ -1,5 +1,7 @@
*Rails 3.2.0 (unreleased)* *Rails 3.2.0 (unreleased)*
* Scaffold returns 204 No Content for API requests without content. This makes scaffold work with jQuery out of the box. [José Valim]
* Updated Rails::Rack::Logger middleware to apply any tags set in config.log_tags to the newly ActiveSupport::TaggedLogging Rails.logger. This makes it easy to tag log lines with debug information like subdomain and request id -- both very helpful in debugging multi-user production applications [DHH] * Updated Rails::Rack::Logger middleware to apply any tags set in config.log_tags to the newly ActiveSupport::TaggedLogging Rails.logger. This makes it easy to tag log lines with debug information like subdomain and request id -- both very helpful in debugging multi-user production applications [DHH]
* Default options to `rails new` can be set in ~/.railsrc [Guillermo Iguaran] * Default options to `rails new` can be set in ~/.railsrc [Guillermo Iguaran]

View file

@ -62,7 +62,7 @@ class <%= controller_class_name %>Controller < ApplicationController
respond_to do |format| respond_to do |format|
if @<%= orm_instance.update_attributes("params[:#{singular_table_name}]") %> 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.html { redirect_to @<%= singular_table_name %>, <%= key_value :notice, "'#{human_name} was successfully updated.'" %> }
format.json { head :ok } format.json { head :no_content }
else else
format.html { render <%= key_value :action, '"edit"' %> } format.html { render <%= key_value :action, '"edit"' %> }
format.json { render <%= key_value :json, "@#{orm_instance.errors}" %>, <%= key_value :status, ':unprocessable_entity' %> } 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| respond_to do |format|
format.html { redirect_to <%= index_helper %>_url } format.html { redirect_to <%= index_helper %>_url }
format.json { head :ok } format.json { head :no_content }
end end
end end
end end