0
所以我對rails非常陌生,我正在學習本教程並遇到以下問題。無法從Michael Hartl教程中獲得這個簡單的代碼
所以我已經建立了我的看法/助理/ 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
和我的看法/佈局/ 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>
和圖/佈局/ 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>
現在,從我下站立,這意味着它應該顯示「安博t Us'頁面標題這樣
「Ruby on Rails教程樣例應用程序|關於我們」?
正確
但我看到的是:
「關於我們」
我曾試圖消除
<% provide(:title, 'About Us') %>
,並把它所有的地方。
有什麼建議嗎?
非常感謝!
AHH!我瞥見了關於使用鉻的部分。謝謝! – 2013-04-24 19:14:24