aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--guides/source/5_0_release_notes.md2
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb6
-rw-r--r--railties/test/generators/app_generator_test.rb6
3 files changed, 13 insertions, 1 deletions
diff --git a/guides/source/5_0_release_notes.md b/guides/source/5_0_release_notes.md
index 78ce092a2b..2fbd75e1c8 100644
--- a/guides/source/5_0_release_notes.md
+++ b/guides/source/5_0_release_notes.md
@@ -385,7 +385,7 @@ Please refer to the [Changelog][active-model] for detailed changes.
### Deprecations
* Deprecated returning `false` as a way to halt Active Model and
- `ActiveModel::Valdiations` callback chains. The recommended way is to
+ `ActiveModel::Validations` callback chains. The recommended way is to
`throw(:abort)`. ([Pull Request](https://github.com/rails/rails/pull/17227))
### Notable changes
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 16efa96207..f4deec7135 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -329,6 +329,12 @@ module Rails
end
end
+ def delete_api_initializers
+ unless options[:api]
+ remove_file 'config/initializers/cors.rb'
+ end
+ end
+
def finish_template
build(:leftovers)
end
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 66997c5f5e..314d8c50b0 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -151,6 +151,12 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file("config/initializers/cookies_serializer.rb", /Rails\.application\.config\.action_dispatch\.cookies_serializer = :json/)
end
+ def test_new_application_not_include_api_initializers
+ run_generator
+
+ assert_no_file 'config/initializers/cors.rb'
+ end
+
def test_rails_update_keep_the_cookie_serializer_if_it_is_already_configured
app_root = File.join(destination_root, 'myapp')
run_generator [app_root]