diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2015-05-15 11:28:52 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2015-06-11 16:54:16 -0300 |
commit | 72d0784611af76dd0bb3154a662c6ec14a022f4c (patch) | |
tree | 5cf70a5cba65776252969c513f77570b9aa7d1a0 /railties/lib | |
parent | 80702b78e1686e5569d8e0b86f2500a2df25c9cf (diff) | |
download | rails-72d0784611af76dd0bb3154a662c6ec14a022f4c.tar.gz rails-72d0784611af76dd0bb3154a662c6ec14a022f4c.tar.bz2 rails-72d0784611af76dd0bb3154a662c6ec14a022f4c.zip |
Make Rails API apps return the full resource on update
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb index ca76da6530..695b7cc90b 100644 --- a/railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb +++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb @@ -32,7 +32,7 @@ class <%= controller_class_name %>Controller < ApplicationController # PATCH/PUT <%= route_url %>/1 def update if @<%= orm_instance.update("#{singular_table_name}_params") %> - head :no_content + render json: <%= "@#{singular_table_name}" %> else render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity end diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb b/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb index 423437bba1..7e41162d47 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb +++ b/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb @@ -27,7 +27,7 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase test "should update <%= singular_table_name %>" do patch :update, params: { id: <%= "@#{singular_table_name}" %>, <%= "#{singular_table_name}: { #{attributes_hash} }" %> } - assert_response 204 + assert_response 200 end test "should destroy <%= singular_table_name %>" do |