aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/rails/app/app_generator.rb
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2018-02-18 16:55:03 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2018-02-18 16:55:06 -0500
commit185e6daa3fccb8b5d2308162fd7e7be46bc1dd52 (patch)
treea5dc963bea74384f021ac959d53ce1e84d260a25 /railties/lib/rails/generators/rails/app/app_generator.rb
parent6cc000c34cc6ecea9262033c46ad795f9bc56f07 (diff)
downloadrails-185e6daa3fccb8b5d2308162fd7e7be46bc1dd52.tar.gz
rails-185e6daa3fccb8b5d2308162fd7e7be46bc1dd52.tar.bz2
rails-185e6daa3fccb8b5d2308162fd7e7be46bc1dd52.zip
Don't generate empty app/views folder when --api and --skip-action-mailer are used together
The purpose of keeping app/views folder in API apps is that it's used for mailer views so doesn't makes sense to keep it when Action Mailer is skipped.
Diffstat (limited to 'railties/lib/rails/generators/rails/app/app_generator.rb')
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 72b9044858..f206f97c9d 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -389,9 +389,13 @@ module Rails
end
end
- def delete_application_layout_file_if_api_option
+ def delete_app_views_if_api_option
if options[:api]
- remove_file "app/views/layouts/application.html.erb"
+ if options[:skip_action_mailer]
+ remove_dir "app/views"
+ else
+ remove_file "app/views/layouts/application.html.erb"
+ end
end
end