aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2016-02-12 21:13:40 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2016-02-15 22:13:32 +0900
commit0146a055c001d0e48eaa5c5df8ccc8a5d15f6708 (patch)
tree250f86268858d797fe280a4d6f1d7e4849fb91b3 /railties/lib
parent737b718ea0c88d3f6c139343f957f386e06fffc9 (diff)
downloadrails-0146a055c001d0e48eaa5c5df8ccc8a5d15f6708.tar.gz
rails-0146a055c001d0e48eaa5c5df8ccc8a5d15f6708.tar.bz2
rails-0146a055c001d0e48eaa5c5df8ccc8a5d15f6708.zip
generate mailer views in Rails API
View files is necessary to send mail, it should be generated even Rails API. Fixes #23617
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators.rb6
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb4
2 files changed, 7 insertions, 3 deletions
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb
index e3d79521e7..330bd7ec5d 100644
--- a/railties/lib/rails/generators.rb
+++ b/railties/lib/rails/generators.rb
@@ -105,7 +105,7 @@ module Rails
# Configure generators for API only applications. It basically hides
# everything that is usually browser related, such as assets and session
- # migration generators, and completely disable views, helpers and assets
+ # migration generators, and completely disable helpers and assets
# so generators such as scaffold won't create them.
def self.api_only!
hide_namespaces "assets", "helper", "css", "js"
@@ -116,6 +116,10 @@ module Rails
helper: false,
template_engine: nil
)
+
+ if ARGV.first == 'mailer'
+ options[:rails].merge!(template_engine: :erb)
+ end
end
# Remove the color from output.
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 248ad20019..885f0c20f6 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -276,9 +276,9 @@ module Rails
end
end
- def delete_app_views_if_api_option
+ def delete_application_layout_file_if_api_option
if options[:api]
- remove_dir 'app/views'
+ remove_file 'app/views/layouts/application.html.erb'
end
end