From 002713c64568114f3754799acc0723ea0d442f7a Mon Sep 17 00:00:00 2001 From: David Lee Date: Fri, 6 May 2011 14:03:55 -0700 Subject: Add config.default_method_for_update to support PATCH PATCH is the correct HTML verb to map to the #update action. The semantics for PATCH allows for partial updates, whereas PUT requires a complete replacement. Changes: * adds config.default_method_for_update you can set to :patch * optionally use PATCH instead of PUT in resource routes and forms * adds the #patch verb to routes to detect PATCH requests * adds #patch? to Request * changes documentation and comments to indicate support for PATCH This change maintains complete backwards compatibility by keeping :put as the default for config.default_method_for_update. --- railties/test/generators/app_generator_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'railties/test/generators') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index a3c24c392b..55c7ce1047 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -325,6 +325,11 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_file "config/application.rb", /#\s+require\s+["']active_record\/railtie["']/ end + def test_default_method_for_update_is_not_patch + run_generator [destination_root, "--skip-test-unit", "--skip-active-record"] + assert_file "config/application.rb", /#\s+config\.default_method_for_update\s+=\s+:patch/ + end + def test_new_hash_style run_generator [destination_root] assert_file "config/initializers/session_store.rb" do |file| -- cgit v1.2.3