Skip to content

Commit 052b5ed

Browse files
authored
Improve title tag for new apps (rails#51134)
* Fix regex for application name assertion * Change title tag to default to a titleized app name
1 parent 6ca6aba commit 052b5ed

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title><%%= content_for(:title) || "<%= camelized %>" %></title>
4+
<title><%%= content_for(:title) || "<%= app_name.titleize %>" %></title>
55
<meta name="viewport" content="width=device-width,initial-scale=1">
66
<meta name="apple-mobile-web-app-capable" content="yes">
77
<%%= csrf_meta_tags %>

railties/test/generators/app_generator_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def test_application_names_are_not_singularized
421421

422422
def test_application_name_is_normalized_in_config
423423
run_generator [File.join(destination_root, "MyWebSite"), "-d", "postgresql"]
424-
assert_file "MyWebSite/app/views/layouts/application.html.erb", /<title><%= content_for(:title) || "MyWebSite" %><\/title>/
424+
assert_file "MyWebSite/app/views/layouts/application.html.erb", /content_for\(:title\) \|\| "My Web Site"/
425425
assert_file "MyWebSite/config/database.yml", /my_web_site_production/
426426
end
427427

0 commit comments

Comments
 (0)