したがって、私はレールに非常に慣れていないため、このチュートリアルを受講していて、次の問題に遭遇しました。
したがって、view/helpers/application_helper.rb を次のように設定しました。
module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title)
base_title = "Ruby on Rails Tutorial Sample App"
if page_title.empty?
base_title
else
"#{base_title} | #{page_title}"
end
end
end
そして私のview/layouts/application.html.erbは次のようになります:
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", :media => "all" %> <%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
view/layouts/about.html.erb は次のようになります。
<% provide(:title, 'About Us') %>
<h1>About Us</h1>
<p>
The <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> is a project to make a book and screencasts to teach web development with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This
is the sample application for the tutorial.
</p>
さて、私の理解では、「About Us」ページのタイトルをこのように表示する必要があることを意味します
「Ruby on Rails チュートリアル サンプルアプリ | 会社概要」
正しい?
ただし、私が見るのは次のとおりです。
"私たちに関しては"
を削除してみました
<% provide(:title, 'About Us') %>
そしてあちこちに配置。
助言がありますか?
どうもありがとう!