0
我在application_helper.rb中设置了一个title实例变量,但base_title不显示在浏览器中。你能告诉我什么是错的吗?标题显示不正确
application_helper.rb
module ApplicationHelper
# Return a title on a per-page basis
def title
base_title = "Ruby on Rails Tutorial Sample App"
if @title.nil?
base_title
else
"#{base_title} | #{@title}"
end
end
end
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title><%= @title %></title>
<%= csrf_meta_tag %>
</head>
<body>
<%= yield %>
</body>
</html>
工作正常。非常感谢你。 – pdenlinger 2012-02-04 16:41:44