diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-03-23 21:57:42 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2017-04-16 16:26:05 +0200 |
commit | a4c1282854795d1f0d7696ce1ccbabf94b3d9098 (patch) | |
tree | 5cdc43670a331fb1195f2f4ff929ff5dce42e554 /railties | |
parent | 6309b85100dd2b55c716ee4a4e9cbd3da2dc0617 (diff) | |
download | rails-a4c1282854795d1f0d7696ce1ccbabf94b3d9098.tar.gz rails-a4c1282854795d1f0d7696ce1ccbabf94b3d9098.tar.bz2 rails-a4c1282854795d1f0d7696ce1ccbabf94b3d9098.zip |
Add `form_with_generates_remote_forms` config.
Allows users to not have remote forms by default, since there's
more JS harness, e.g. bundling rails-ujs, otherwise.
Also don't skip creating defaults file anymore. Sprockets isn't the only new config.
Diffstat (limited to 'railties')
3 files changed, 4 insertions, 4 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 324843a5f5..f4717bb35b 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -403,9 +403,7 @@ module Rails end def delete_new_framework_defaults - # Sprockets owns the only new default for 5.1: if it's disabled, - # we don't want the file. - unless options[:update] && !options[:skip_sprockets] + unless options[:update] remove_file "config/initializers/new_framework_defaults_5_1.rb" end end diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_1.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_1.rb.tt index 5f5545c4c7..a0c7f44b60 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_1.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_1.rb.tt @@ -5,6 +5,9 @@ # Once upgraded flip defaults one by one to migrate to the new default. # # Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make `form_with` generate non-remote forms. +Rails.application.config.action_view.form_with_generates_remote_forms = false <%- unless options[:skip_sprockets] -%> # Unknown asset fallback will return the path passed in when the given diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 7965bd68d0..d3e131db94 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -410,7 +410,6 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_no_match(/config\.assets\.js_compressor = :uglifier/, content) assert_no_match(/config\.assets\.css_compressor = :sass/, content) end - assert_no_file "config/initializers/new_framework_defaults_5_1.rb" end def test_generator_if_skip_yarn_is_given |