From 21cd5b3031b0c022439a88cb750c1e00cd07f1e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 27 Nov 2017 11:52:39 -0500 Subject: [PATCH] Make form_with_generates_ids default value to be false This will keep the behavior of an application with the defaults of a 4.2 or 5.0 application behaving the same when upgrading to 5.2. --- actionview/lib/action_view/helpers/form_helper.rb | 2 +- actionview/test/template/form_helper/form_with_test.rb | 9 +++++++++ railties/lib/rails/application/configuration.rb | 4 ---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index f24e83ad9a..6185aa133f 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -478,7 +478,7 @@ module ActionView mattr_accessor :form_with_generates_remote_forms, default: true - mattr_accessor :form_with_generates_ids, default: true + mattr_accessor :form_with_generates_ids, default: false # Creates a form tag based on mixing URLs, scopes, or models. # diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb index 4e268eaa16..0295ff627d 100644 --- a/actionview/test/template/form_helper/form_with_test.rb +++ b/actionview/test/template/form_helper/form_with_test.rb @@ -5,6 +5,15 @@ require "controller/fake_models" class FormWithTest < ActionView::TestCase include RenderERBUtils + + setup do + @old_value = ActionView::Helpers::FormHelper.form_with_generates_ids + ActionView::Helpers::FormHelper.form_with_generates_ids = true + end + + teardown do + ActionView::Helpers::FormHelper.form_with_generates_ids = @old_value + end end class FormWithActsLikeFormTagTest < FormWithTest diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 0ff0aeb73e..cbc04f8a48 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -73,10 +73,6 @@ module Rails end self.ssl_options = { hsts: { subdomains: true } } - - if respond_to?(:action_view) - action_view.form_with_generates_ids = false - end when "5.1" load_defaults "5.0"